comparison src/select-x.c @ 5616:79e9934779c1

Use va_run_hooks_with_args() for x-sent-selection-hooks, lost-selection-hooks src/ChangeLog addition: 2011-12-22 Aidan Kehoe <kehoea@parhasard.net> * select-gtk.c (vars_of_select_gtk): * select-x.c: * select-x.c (x_handle_selection_request): * select-x.c (syms_of_select_x): * select-x.c (vars_of_select_x): * select.c: * select.c (handle_selection_clear): * select.c (syms_of_select): * select.c (vars_of_select): Use va_run_hooks_with_args for x-sent-selection-hooks and lost-selection-hooks, instead of rolling our own.
author Aidan Kehoe <kehoea@parhasard.net>
date Thu, 22 Dec 2011 15:02:02 +0000
parents 56144c8593a8
children 2f22818d92d4
comparison
equal deleted inserted replaced
5615:5f4f92a31875 5616:79e9934779c1
61 Lisp_Object QCUT_BUFFER0, QCUT_BUFFER1, QCUT_BUFFER2, QCUT_BUFFER3, 61 Lisp_Object QCUT_BUFFER0, QCUT_BUFFER1, QCUT_BUFFER2, QCUT_BUFFER3,
62 QCUT_BUFFER4, QCUT_BUFFER5, QCUT_BUFFER6, QCUT_BUFFER7; 62 QCUT_BUFFER4, QCUT_BUFFER5, QCUT_BUFFER6, QCUT_BUFFER7;
63 #endif 63 #endif
64 64
65 Lisp_Object Vx_sent_selection_hooks; 65 Lisp_Object Vx_sent_selection_hooks;
66
67 Lisp_Object Qx_sent_selection_hooks;
66 68
67 /* If this is a smaller number than the max-request-size of the display, 69 /* If this is a smaller number than the max-request-size of the display,
68 emacs will use INCR selection transfer when the selection is larger 70 emacs will use INCR selection transfer when the selection is larger
69 than this. The max-request-size is usually around 64k, so if you want 71 than this. The max-request-size is usually around 64k, so if you want
70 emacs to use incremental selection transfers when the selection is 72 emacs to use incremental selection transfers when the selection is
698 DONE_LABEL: 700 DONE_LABEL:
699 701
700 UNGCPRO; 702 UNGCPRO;
701 703
702 /* Let random lisp code notice that the selection has been asked for. */ 704 /* Let random lisp code notice that the selection has been asked for. */
703 { 705 va_run_hook_with_args (Qx_sent_selection_hooks, 3, selection_symbol,
704 Lisp_Object val = Vx_sent_selection_hooks; 706 target_symbol, successful_p);
705 if (!UNBOUNDP (val) && !NILP (val))
706 {
707 Lisp_Object rest;
708 if (CONSP (val) && !EQ (XCAR (val), Qlambda))
709 for (rest = val; !NILP (rest); rest = Fcdr (rest))
710 call3 (Fcar (rest), selection_symbol, target_symbol, successful_p);
711 else
712 call3 (val, selection_symbol, target_symbol, successful_p);
713 }
714 }
715 } 707 }
716 708
717 709
718 /* Called from the event-loop in response to a SelectionClear event. 710 /* Called from the event-loop in response to a SelectionClear event.
719 */ 711 */
1500 DEFSUBR (Fx_get_cutbuffer_internal); 1492 DEFSUBR (Fx_get_cutbuffer_internal);
1501 DEFSUBR (Fx_store_cutbuffer_internal); 1493 DEFSUBR (Fx_store_cutbuffer_internal);
1502 DEFSUBR (Fx_rotate_cutbuffers_internal); 1494 DEFSUBR (Fx_rotate_cutbuffers_internal);
1503 #endif /* CUT_BUFFER_SUPPORT */ 1495 #endif /* CUT_BUFFER_SUPPORT */
1504 1496
1497 DEFSYMBOL (Qx_sent_selection_hooks);
1498
1505 /* Unfortunately, timeout handlers must be lisp functions. */ 1499 /* Unfortunately, timeout handlers must be lisp functions. */
1506 DEFSYMBOL (Qx_selection_reply_timeout_internal); 1500 DEFSYMBOL (Qx_selection_reply_timeout_internal);
1507 DEFSUBR (Fx_selection_reply_timeout_internal); 1501 DEFSUBR (Fx_selection_reply_timeout_internal);
1508 1502
1509 #ifdef CUT_BUFFER_SUPPORT 1503 #ifdef CUT_BUFFER_SUPPORT
1557 including being asked for a selection that we no longer own, or being asked 1551 including being asked for a selection that we no longer own, or being asked
1558 to convert into a type that we don't know about or that is inappropriate. 1552 to convert into a type that we don't know about or that is inappropriate.
1559 This hook doesn't let you change the behavior of emacs's selection replies, 1553 This hook doesn't let you change the behavior of emacs's selection replies,
1560 it merely informs you that they have happened. 1554 it merely informs you that they have happened.
1561 */ ); 1555 */ );
1562 Vx_sent_selection_hooks = Qunbound; 1556 Vx_sent_selection_hooks = Qnil;
1563 1557
1564 DEFVAR_INT ("x-selection-timeout", &x_selection_timeout /* 1558 DEFVAR_INT ("x-selection-timeout", &x_selection_timeout /*
1565 If the selection owner doesn't reply in this many seconds, we give up. 1559 If the selection owner doesn't reply in this many seconds, we give up.
1566 A value of 0 means wait as long as necessary. This is initialized from the 1560 A value of 0 means wait as long as necessary. This is initialized from the
1567 \"*selectionTimeout\" resource (which is expressed in milliseconds). 1561 \"*selectionTimeout\" resource (which is expressed in milliseconds).