Mercurial > emacs
comparison src/xselect.c @ 25646:9154af188477
Use XCAR and XCDR instead of explicit member references.
author | Ken Raeburn <raeburn@raeburn.org> |
---|---|
date | Sun, 12 Sep 1999 07:05:34 +0000 |
parents | 719325fbe6a1 |
children | 3e56c05edfab |
comparison
equal
deleted
inserted
replaced
25645:a14111a2a100 | 25646:9154af188477 |
---|---|
276 Don't use Fdelq as that may QUIT. */ | 276 Don't use Fdelq as that may QUIT. */ |
277 if (!NILP (prev_value)) | 277 if (!NILP (prev_value)) |
278 { | 278 { |
279 Lisp_Object rest; /* we know it's not the CAR, so it's easy. */ | 279 Lisp_Object rest; /* we know it's not the CAR, so it's easy. */ |
280 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) | 280 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) |
281 if (EQ (prev_value, Fcar (XCONS (rest)->cdr))) | 281 if (EQ (prev_value, Fcar (XCDR (rest)))) |
282 { | 282 { |
283 XCONS (rest)->cdr = Fcdr (XCONS (rest)->cdr); | 283 XCDR (rest) = Fcdr (XCDR (rest)); |
284 break; | 284 break; |
285 } | 285 } |
286 } | 286 } |
287 } | 287 } |
288 } | 288 } |
309 | 309 |
310 /* TIMESTAMP and MULTIPLE are special cases 'cause that's easiest. */ | 310 /* TIMESTAMP and MULTIPLE are special cases 'cause that's easiest. */ |
311 if (EQ (target_type, QTIMESTAMP)) | 311 if (EQ (target_type, QTIMESTAMP)) |
312 { | 312 { |
313 handler_fn = Qnil; | 313 handler_fn = Qnil; |
314 value = XCONS (XCONS (XCONS (local_value)->cdr)->cdr)->car; | 314 value = XCAR (XCDR (XCDR (local_value))); |
315 } | 315 } |
316 #if 0 | 316 #if 0 |
317 else if (EQ (target_type, QDELETE)) | 317 else if (EQ (target_type, QDELETE)) |
318 { | 318 { |
319 handler_fn = Qnil; | 319 handler_fn = Qnil; |
320 Fx_disown_selection_internal | 320 Fx_disown_selection_internal |
321 (selection_symbol, | 321 (selection_symbol, |
322 XCONS (XCONS (XCONS (local_value)->cdr)->cdr)->car); | 322 XCAR (XCDR (XCDR (local_value)))); |
323 value = QNULL; | 323 value = QNULL; |
324 } | 324 } |
325 #endif | 325 #endif |
326 | 326 |
327 #if 0 /* #### MULTIPLE doesn't work yet */ | 327 #if 0 /* #### MULTIPLE doesn't work yet */ |
328 else if (CONSP (target_type) | 328 else if (CONSP (target_type) |
329 && XCONS (target_type)->car == QMULTIPLE) | 329 && XCAR (target_type) == QMULTIPLE) |
330 { | 330 { |
331 Lisp_Object pairs; | 331 Lisp_Object pairs; |
332 int size; | 332 int size; |
333 int i; | 333 int i; |
334 pairs = XCONS (target_type)->cdr; | 334 pairs = XCDR (target_type); |
335 size = XVECTOR (pairs)->size; | 335 size = XVECTOR (pairs)->size; |
336 /* If the target is MULTIPLE, then target_type looks like | 336 /* If the target is MULTIPLE, then target_type looks like |
337 (MULTIPLE . [[SELECTION1 TARGET1] [SELECTION2 TARGET2] ... ]) | 337 (MULTIPLE . [[SELECTION1 TARGET1] [SELECTION2 TARGET2] ... ]) |
338 We modify the second element of each pair in the vector and | 338 We modify the second element of each pair in the vector and |
339 return it as [[SELECTION1 <value1>] [SELECTION2 <value2>] ... ] | 339 return it as [[SELECTION1 <value1>] [SELECTION2 <value2>] ... ] |
360 CHECK_SYMBOL (target_type, 0); | 360 CHECK_SYMBOL (target_type, 0); |
361 handler_fn = Fcdr (Fassq (target_type, Vselection_converter_alist)); | 361 handler_fn = Fcdr (Fassq (target_type, Vselection_converter_alist)); |
362 if (!NILP (handler_fn)) | 362 if (!NILP (handler_fn)) |
363 value = call3 (handler_fn, | 363 value = call3 (handler_fn, |
364 selection_symbol, target_type, | 364 selection_symbol, target_type, |
365 XCONS (XCONS (local_value)->cdr)->car); | 365 XCAR (XCDR (local_value))); |
366 else | 366 else |
367 value = Qnil; | 367 value = Qnil; |
368 unbind_to (count, Qnil); | 368 unbind_to (count, Qnil); |
369 } | 369 } |
370 | 370 |
371 /* Make sure this value is of a type that we could transmit | 371 /* Make sure this value is of a type that we could transmit |
372 to another X client. */ | 372 to another X client. */ |
373 | 373 |
374 check = value; | 374 check = value; |
375 if (CONSP (value) | 375 if (CONSP (value) |
376 && SYMBOLP (XCONS (value)->car)) | 376 && SYMBOLP (XCAR (value))) |
377 type = XCONS (value)->car, | 377 type = XCAR (value), |
378 check = XCONS (value)->cdr; | 378 check = XCDR (value); |
379 | 379 |
380 if (STRINGP (check) | 380 if (STRINGP (check) |
381 || VECTORP (check) | 381 || VECTORP (check) |
382 || SYMBOLP (check) | 382 || SYMBOLP (check) |
383 || INTEGERP (check) | 383 || INTEGERP (check) |
384 || NILP (value)) | 384 || NILP (value)) |
385 return value; | 385 return value; |
386 /* Check for a value that cons_to_long could handle. */ | 386 /* Check for a value that cons_to_long could handle. */ |
387 else if (CONSP (check) | 387 else if (CONSP (check) |
388 && INTEGERP (XCONS (check)->car) | 388 && INTEGERP (XCAR (check)) |
389 && (INTEGERP (XCONS (check)->cdr) | 389 && (INTEGERP (XCDR (check)) |
390 || | 390 || |
391 (CONSP (XCONS (check)->cdr) | 391 (CONSP (XCDR (check)) |
392 && INTEGERP (XCONS (XCONS (check)->cdr)->car) | 392 && INTEGERP (XCAR (XCDR (check))) |
393 && NILP (XCONS (XCONS (check)->cdr)->cdr)))) | 393 && NILP (XCDR (XCDR (check)))))) |
394 return value; | 394 return value; |
395 else | 395 else |
396 return | 396 return |
397 Fsignal (Qerror, | 397 Fsignal (Qerror, |
398 Fcons (build_string ("invalid data returned by selection-conversion function"), | 398 Fcons (build_string ("invalid data returned by selection-conversion function"), |
685 x_decline_selection_request (event); | 685 x_decline_selection_request (event); |
686 goto DONE; | 686 goto DONE; |
687 } | 687 } |
688 | 688 |
689 local_selection_time = (Time) | 689 local_selection_time = (Time) |
690 cons_to_long (XCONS (XCONS (XCONS (local_selection_data)->cdr)->cdr)->car); | 690 cons_to_long (XCAR (XCDR (XCDR (local_selection_data)))); |
691 | 691 |
692 if (SELECTION_EVENT_TIME (event) != CurrentTime | 692 if (SELECTION_EVENT_TIME (event) != CurrentTime |
693 && local_selection_time > SELECTION_EVENT_TIME (event)) | 693 && local_selection_time > SELECTION_EVENT_TIME (event)) |
694 { | 694 { |
695 /* Someone asked for the selection, and we have one, but not the one | 695 /* Someone asked for the selection, and we have one, but not the one |
797 | 797 |
798 /* Well, we already believe that we don't own it, so that's just fine. */ | 798 /* Well, we already believe that we don't own it, so that's just fine. */ |
799 if (NILP (local_selection_data)) return; | 799 if (NILP (local_selection_data)) return; |
800 | 800 |
801 local_selection_time = (Time) | 801 local_selection_time = (Time) |
802 cons_to_long (XCONS (XCONS (XCONS (local_selection_data)->cdr)->cdr)->car); | 802 cons_to_long (XCAR (XCDR (XCDR (local_selection_data)))); |
803 | 803 |
804 /* This SelectionClear is for a selection that we no longer own, so we can | 804 /* This SelectionClear is for a selection that we no longer own, so we can |
805 disregard it. (That is, we have reasserted the selection since this | 805 disregard it. (That is, we have reasserted the selection since this |
806 request was generated.) */ | 806 request was generated.) */ |
807 | 807 |
816 Vselection_alist = Fcdr (Vselection_alist); | 816 Vselection_alist = Fcdr (Vselection_alist); |
817 else | 817 else |
818 { | 818 { |
819 Lisp_Object rest; | 819 Lisp_Object rest; |
820 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) | 820 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) |
821 if (EQ (local_selection_data, Fcar (XCONS (rest)->cdr))) | 821 if (EQ (local_selection_data, Fcar (XCDR (rest)))) |
822 { | 822 { |
823 XCONS (rest)->cdr = Fcdr (XCONS (rest)->cdr); | 823 XCDR (rest) = Fcdr (XCDR (rest)); |
824 break; | 824 break; |
825 } | 825 } |
826 } | 826 } |
827 | 827 |
828 /* Let random lisp code notice that the selection has been stolen. */ | 828 /* Let random lisp code notice that the selection has been stolen. */ |
879 Vselection_alist = Fcdr (Vselection_alist); | 879 Vselection_alist = Fcdr (Vselection_alist); |
880 } | 880 } |
881 | 881 |
882 /* Delete elements after the beginning of Vselection_alist. */ | 882 /* Delete elements after the beginning of Vselection_alist. */ |
883 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) | 883 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) |
884 if (EQ (frame, Fcar (Fcdr (Fcdr (Fcdr (Fcar (XCONS (rest)->cdr))))))) | 884 if (EQ (frame, Fcar (Fcdr (Fcdr (Fcdr (Fcar (XCDR (rest)))))))) |
885 { | 885 { |
886 /* Let random Lisp code notice that the selection has been stolen. */ | 886 /* Let random Lisp code notice that the selection has been stolen. */ |
887 Lisp_Object hooks, selection_symbol; | 887 Lisp_Object hooks, selection_symbol; |
888 | 888 |
889 hooks = Vx_lost_selection_hooks; | 889 hooks = Vx_lost_selection_hooks; |
890 selection_symbol = Fcar (Fcar (XCONS (rest)->cdr)); | 890 selection_symbol = Fcar (Fcar (XCDR (rest))); |
891 | 891 |
892 if (!EQ (hooks, Qunbound)) | 892 if (!EQ (hooks, Qunbound)) |
893 { | 893 { |
894 for (; CONSP (hooks); hooks = Fcdr (hooks)) | 894 for (; CONSP (hooks); hooks = Fcdr (hooks)) |
895 call1 (Fcar (hooks), selection_symbol); | 895 call1 (Fcar (hooks), selection_symbol); |
896 #if 0 /* See above */ | 896 #if 0 /* See above */ |
897 redisplay_preserve_echo_area (); | 897 redisplay_preserve_echo_area (); |
898 #endif | 898 #endif |
899 } | 899 } |
900 XCONS (rest)->cdr = Fcdr (XCONS (rest)->cdr); | 900 XCDR (rest) = Fcdr (XCDR (rest)); |
901 break; | 901 break; |
902 } | 902 } |
903 } | 903 } |
904 | 904 |
905 /* Nonzero if any properties for DISPLAY and WINDOW | 905 /* Nonzero if any properties for DISPLAY and WINDOW |
973 static Lisp_Object | 973 static Lisp_Object |
974 wait_for_property_change_unwind (identifierval) | 974 wait_for_property_change_unwind (identifierval) |
975 Lisp_Object identifierval; | 975 Lisp_Object identifierval; |
976 { | 976 { |
977 unexpect_property_change ((struct prop_location *) | 977 unexpect_property_change ((struct prop_location *) |
978 (XFASTINT (XCONS (identifierval)->car) << 16 | 978 (XFASTINT (XCAR (identifierval)) << 16 |
979 | XFASTINT (XCONS (identifierval)->cdr))); | 979 | XFASTINT (XCDR (identifierval)))); |
980 return Qnil; | 980 return Qnil; |
981 } | 981 } |
982 | 982 |
983 /* Actually wait for a property change. | 983 /* Actually wait for a property change. |
984 IDENTIFIER should be the value that expect_property_change returned. */ | 984 IDENTIFIER should be the value that expect_property_change returned. */ |
990 int secs, usecs; | 990 int secs, usecs; |
991 int count = specpdl_ptr - specpdl; | 991 int count = specpdl_ptr - specpdl; |
992 Lisp_Object tem; | 992 Lisp_Object tem; |
993 | 993 |
994 tem = Fcons (Qnil, Qnil); | 994 tem = Fcons (Qnil, Qnil); |
995 XSETFASTINT (XCONS (tem)->car, (EMACS_UINT)location >> 16); | 995 XSETFASTINT (XCAR (tem), (EMACS_UINT)location >> 16); |
996 XSETFASTINT (XCONS (tem)->cdr, (EMACS_UINT)location & 0xffff); | 996 XSETFASTINT (XCDR (tem), (EMACS_UINT)location & 0xffff); |
997 | 997 |
998 /* Make sure to do unexpect_property_change if we quit or err. */ | 998 /* Make sure to do unexpect_property_change if we quit or err. */ |
999 record_unwind_protect (wait_for_property_change_unwind, tem); | 999 record_unwind_protect (wait_for_property_change_unwind, tem); |
1000 | 1000 |
1001 XCONS (property_change_reply)->car = Qnil; | 1001 XCAR (property_change_reply) = Qnil; |
1002 | 1002 |
1003 property_change_reply_object = location; | 1003 property_change_reply_object = location; |
1004 /* If the event we are waiting for arrives beyond here, it will set | 1004 /* If the event we are waiting for arrives beyond here, it will set |
1005 property_change_reply, because property_change_reply_object says so. */ | 1005 property_change_reply, because property_change_reply_object says so. */ |
1006 if (! location->arrived) | 1006 if (! location->arrived) |
1007 { | 1007 { |
1008 secs = x_selection_timeout / 1000; | 1008 secs = x_selection_timeout / 1000; |
1009 usecs = (x_selection_timeout % 1000) * 1000; | 1009 usecs = (x_selection_timeout % 1000) * 1000; |
1010 wait_reading_process_input (secs, usecs, property_change_reply, 0); | 1010 wait_reading_process_input (secs, usecs, property_change_reply, 0); |
1011 | 1011 |
1012 if (NILP (XCONS (property_change_reply)->car)) | 1012 if (NILP (XCAR (property_change_reply))) |
1013 error ("Timed out waiting for property-notify event"); | 1013 error ("Timed out waiting for property-notify event"); |
1014 } | 1014 } |
1015 | 1015 |
1016 unbind_to (count, Qnil); | 1016 unbind_to (count, Qnil); |
1017 } | 1017 } |
1041 rest->arrived = 1; | 1041 rest->arrived = 1; |
1042 | 1042 |
1043 /* If this is the one wait_for_property_change is waiting for, | 1043 /* If this is the one wait_for_property_change is waiting for, |
1044 tell it to wake up. */ | 1044 tell it to wake up. */ |
1045 if (rest == property_change_reply_object) | 1045 if (rest == property_change_reply_object) |
1046 XCONS (property_change_reply)->car = Qt; | 1046 XCAR (property_change_reply) = Qt; |
1047 | 1047 |
1048 if (prev) | 1048 if (prev) |
1049 prev->next = rest->next; | 1049 prev->next = rest->next; |
1050 else | 1050 else |
1051 property_change_wait_list = rest->next; | 1051 property_change_wait_list = rest->next; |
1090 { | 1090 { |
1091 Lisp_Object vec; | 1091 Lisp_Object vec; |
1092 int i; | 1092 int i; |
1093 int size; | 1093 int size; |
1094 if (CONSP (obj)) | 1094 if (CONSP (obj)) |
1095 return Fcons (XCONS (obj)->car, copy_multiple_data (XCONS (obj)->cdr)); | 1095 return Fcons (XCAR (obj), copy_multiple_data (XCDR (obj))); |
1096 | 1096 |
1097 CHECK_VECTOR (obj, 0); | 1097 CHECK_VECTOR (obj, 0); |
1098 vec = Fmake_vector (size = XVECTOR (obj)->size, Qnil); | 1098 vec = Fmake_vector (size = XVECTOR (obj)->size, Qnil); |
1099 for (i = 0; i < size; i++) | 1099 for (i = 0; i < size; i++) |
1100 { | 1100 { |
1138 int secs, usecs; | 1138 int secs, usecs; |
1139 int count; | 1139 int count; |
1140 Lisp_Object frame; | 1140 Lisp_Object frame; |
1141 | 1141 |
1142 if (CONSP (target_type)) | 1142 if (CONSP (target_type)) |
1143 type_atom = symbol_to_x_atom (dpyinfo, display, XCONS (target_type)->car); | 1143 type_atom = symbol_to_x_atom (dpyinfo, display, XCAR (target_type)); |
1144 else | 1144 else |
1145 type_atom = symbol_to_x_atom (dpyinfo, display, target_type); | 1145 type_atom = symbol_to_x_atom (dpyinfo, display, target_type); |
1146 | 1146 |
1147 BLOCK_INPUT; | 1147 BLOCK_INPUT; |
1148 count = x_catch_errors (display); | 1148 count = x_catch_errors (display); |
1151 XFlush (display); | 1151 XFlush (display); |
1152 | 1152 |
1153 /* Prepare to block until the reply has been read. */ | 1153 /* Prepare to block until the reply has been read. */ |
1154 reading_selection_window = requestor_window; | 1154 reading_selection_window = requestor_window; |
1155 reading_which_selection = selection_atom; | 1155 reading_which_selection = selection_atom; |
1156 XCONS (reading_selection_reply)->car = Qnil; | 1156 XCAR (reading_selection_reply) = Qnil; |
1157 | 1157 |
1158 frame = some_frame_on_display (dpyinfo); | 1158 frame = some_frame_on_display (dpyinfo); |
1159 | 1159 |
1160 /* If the display no longer has frames, we can't expect | 1160 /* If the display no longer has frames, we can't expect |
1161 to get many more selection requests from it, so don't | 1161 to get many more selection requests from it, so don't |
1177 BLOCK_INPUT; | 1177 BLOCK_INPUT; |
1178 x_check_errors (display, "Cannot get selection: %s"); | 1178 x_check_errors (display, "Cannot get selection: %s"); |
1179 x_uncatch_errors (display, count); | 1179 x_uncatch_errors (display, count); |
1180 UNBLOCK_INPUT; | 1180 UNBLOCK_INPUT; |
1181 | 1181 |
1182 if (NILP (XCONS (reading_selection_reply)->car)) | 1182 if (NILP (XCAR (reading_selection_reply))) |
1183 error ("Timed out waiting for reply from selection owner"); | 1183 error ("Timed out waiting for reply from selection owner"); |
1184 if (EQ (XCONS (reading_selection_reply)->car, Qlambda)) | 1184 if (EQ (XCAR (reading_selection_reply), Qlambda)) |
1185 error ("No `%s' selection", XSYMBOL (selection_symbol)->name->data); | 1185 error ("No `%s' selection", XSYMBOL (selection_symbol)->name->data); |
1186 | 1186 |
1187 /* Otherwise, the selection is waiting for us on the requested property. */ | 1187 /* Otherwise, the selection is waiting for us on the requested property. */ |
1188 return | 1188 return |
1189 x_get_window_property_as_lisp_data (display, requestor_window, | 1189 x_get_window_property_as_lisp_data (display, requestor_window, |
1625 Lisp_Object type = Qnil; | 1625 Lisp_Object type = Qnil; |
1626 struct x_display_info *dpyinfo = x_display_info_for_display (display); | 1626 struct x_display_info *dpyinfo = x_display_info_for_display (display); |
1627 | 1627 |
1628 *nofree_ret = 0; | 1628 *nofree_ret = 0; |
1629 | 1629 |
1630 if (CONSP (obj) && SYMBOLP (XCONS (obj)->car)) | 1630 if (CONSP (obj) && SYMBOLP (XCAR (obj))) |
1631 { | 1631 { |
1632 type = XCONS (obj)->car; | 1632 type = XCAR (obj); |
1633 obj = XCONS (obj)->cdr; | 1633 obj = XCDR (obj); |
1634 if (CONSP (obj) && NILP (XCONS (obj)->cdr)) | 1634 if (CONSP (obj) && NILP (XCDR (obj))) |
1635 obj = XCONS (obj)->car; | 1635 obj = XCAR (obj); |
1636 } | 1636 } |
1637 | 1637 |
1638 if (EQ (obj, QNULL) || (EQ (type, QNULL))) | 1638 if (EQ (obj, QNULL) || (EQ (type, QNULL))) |
1639 { /* This is not the same as declining */ | 1639 { /* This is not the same as declining */ |
1640 *format_ret = 32; | 1640 *format_ret = 32; |
1720 (*data_ret) [sizeof (short)] = 0; | 1720 (*data_ret) [sizeof (short)] = 0; |
1721 (*(short **) data_ret) [0] = (short) XINT (obj); | 1721 (*(short **) data_ret) [0] = (short) XINT (obj); |
1722 if (NILP (type)) type = QINTEGER; | 1722 if (NILP (type)) type = QINTEGER; |
1723 } | 1723 } |
1724 else if (INTEGERP (obj) | 1724 else if (INTEGERP (obj) |
1725 || (CONSP (obj) && INTEGERP (XCONS (obj)->car) | 1725 || (CONSP (obj) && INTEGERP (XCAR (obj)) |
1726 && (INTEGERP (XCONS (obj)->cdr) | 1726 && (INTEGERP (XCDR (obj)) |
1727 || (CONSP (XCONS (obj)->cdr) | 1727 || (CONSP (XCDR (obj)) |
1728 && INTEGERP (XCONS (XCONS (obj)->cdr)->car))))) | 1728 && INTEGERP (XCAR (XCDR (obj))))))) |
1729 { | 1729 { |
1730 *format_ret = 32; | 1730 *format_ret = 32; |
1731 *size_ret = 1; | 1731 *size_ret = 1; |
1732 *data_ret = (unsigned char *) xmalloc (sizeof (long) + 1); | 1732 *data_ret = (unsigned char *) xmalloc (sizeof (long) + 1); |
1733 (*data_ret) [sizeof (long)] = 0; | 1733 (*data_ret) [sizeof (long)] = 0; |
1829 static Lisp_Object | 1829 static Lisp_Object |
1830 clean_local_selection_data (obj) | 1830 clean_local_selection_data (obj) |
1831 Lisp_Object obj; | 1831 Lisp_Object obj; |
1832 { | 1832 { |
1833 if (CONSP (obj) | 1833 if (CONSP (obj) |
1834 && INTEGERP (XCONS (obj)->car) | 1834 && INTEGERP (XCAR (obj)) |
1835 && CONSP (XCONS (obj)->cdr) | 1835 && CONSP (XCDR (obj)) |
1836 && INTEGERP (XCONS (XCONS (obj)->cdr)->car) | 1836 && INTEGERP (XCAR (XCDR (obj))) |
1837 && NILP (XCONS (XCONS (obj)->cdr)->cdr)) | 1837 && NILP (XCDR (XCDR (obj)))) |
1838 obj = Fcons (XCONS (obj)->car, XCONS (obj)->cdr); | 1838 obj = Fcons (XCAR (obj), XCDR (obj)); |
1839 | 1839 |
1840 if (CONSP (obj) | 1840 if (CONSP (obj) |
1841 && INTEGERP (XCONS (obj)->car) | 1841 && INTEGERP (XCAR (obj)) |
1842 && INTEGERP (XCONS (obj)->cdr)) | 1842 && INTEGERP (XCDR (obj))) |
1843 { | 1843 { |
1844 if (XINT (XCONS (obj)->car) == 0) | 1844 if (XINT (XCAR (obj)) == 0) |
1845 return XCONS (obj)->cdr; | 1845 return XCDR (obj); |
1846 if (XINT (XCONS (obj)->car) == -1) | 1846 if (XINT (XCAR (obj)) == -1) |
1847 return make_number (- XINT (XCONS (obj)->cdr)); | 1847 return make_number (- XINT (XCDR (obj))); |
1848 } | 1848 } |
1849 if (VECTORP (obj)) | 1849 if (VECTORP (obj)) |
1850 { | 1850 { |
1851 int i; | 1851 int i; |
1852 int size = XVECTOR (obj)->size; | 1852 int size = XVECTOR (obj)->size; |
1874 if (event->requestor != reading_selection_window) | 1874 if (event->requestor != reading_selection_window) |
1875 return; | 1875 return; |
1876 if (event->selection != reading_which_selection) | 1876 if (event->selection != reading_which_selection) |
1877 return; | 1877 return; |
1878 | 1878 |
1879 XCONS (reading_selection_reply)->car | 1879 XCAR (reading_selection_reply) |
1880 = (event->property != 0 ? Qt : Qlambda); | 1880 = (event->property != 0 ? Qt : Qlambda); |
1881 } | 1881 } |
1882 | 1882 |
1883 | 1883 |
1884 DEFUN ("x-own-selection-internal", Fx_own_selection_internal, | 1884 DEFUN ("x-own-selection-internal", Fx_own_selection_internal, |
1918 check_x (); | 1918 check_x (); |
1919 CHECK_SYMBOL (selection_symbol, 0); | 1919 CHECK_SYMBOL (selection_symbol, 0); |
1920 | 1920 |
1921 #if 0 /* #### MULTIPLE doesn't work yet */ | 1921 #if 0 /* #### MULTIPLE doesn't work yet */ |
1922 if (CONSP (target_type) | 1922 if (CONSP (target_type) |
1923 && XCONS (target_type)->car == QMULTIPLE) | 1923 && XCAR (target_type) == QMULTIPLE) |
1924 { | 1924 { |
1925 CHECK_VECTOR (XCONS (target_type)->cdr, 0); | 1925 CHECK_VECTOR (XCDR (target_type), 0); |
1926 /* So we don't destructively modify this... */ | 1926 /* So we don't destructively modify this... */ |
1927 target_type = copy_multiple_data (target_type); | 1927 target_type = copy_multiple_data (target_type); |
1928 } | 1928 } |
1929 else | 1929 else |
1930 #endif | 1930 #endif |
1937 val = x_get_foreign_selection (selection_symbol, target_type); | 1937 val = x_get_foreign_selection (selection_symbol, target_type); |
1938 goto DONE; | 1938 goto DONE; |
1939 } | 1939 } |
1940 | 1940 |
1941 if (CONSP (val) | 1941 if (CONSP (val) |
1942 && SYMBOLP (XCONS (val)->car)) | 1942 && SYMBOLP (XCAR (val))) |
1943 { | 1943 { |
1944 val = XCONS (val)->cdr; | 1944 val = XCDR (val); |
1945 if (CONSP (val) && NILP (XCONS (val)->cdr)) | 1945 if (CONSP (val) && NILP (XCDR (val))) |
1946 val = XCONS (val)->car; | 1946 val = XCAR (val); |
1947 } | 1947 } |
1948 val = clean_local_selection_data (val); | 1948 val = clean_local_selection_data (val); |
1949 DONE: | 1949 DONE: |
1950 UNGCPRO; | 1950 UNGCPRO; |
1951 return val; | 1951 return val; |
2004 Lisp_Object buffer; | 2004 Lisp_Object buffer; |
2005 { | 2005 { |
2006 Lisp_Object tail; | 2006 Lisp_Object tail; |
2007 struct buffer *buf = XBUFFER (buffer); | 2007 struct buffer *buf = XBUFFER (buffer); |
2008 | 2008 |
2009 for (tail = Vselection_alist; CONSP (tail); tail = XCONS (tail)->cdr) | 2009 for (tail = Vselection_alist; CONSP (tail); tail = XCDR (tail)) |
2010 { | 2010 { |
2011 Lisp_Object elt, value; | 2011 Lisp_Object elt, value; |
2012 elt = XCONS (tail)->car; | 2012 elt = XCAR (tail); |
2013 value = XCONS (elt)->cdr; | 2013 value = XCDR (elt); |
2014 if (CONSP (value) && MARKERP (XCONS (value)->car) | 2014 if (CONSP (value) && MARKERP (XCAR (value)) |
2015 && XMARKER (XCONS (value)->car)->buffer == buf) | 2015 && XMARKER (XCAR (value))->buffer == buf) |
2016 Fx_disown_selection_internal (XCONS (elt)->car, Qnil); | 2016 Fx_disown_selection_internal (XCAR (elt), Qnil); |
2017 } | 2017 } |
2018 } | 2018 } |
2019 | 2019 |
2020 DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p, | 2020 DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p, |
2021 0, 1, 0, | 2021 0, 1, 0, |