Mercurial > hg > xemacs-beta
diff src/select.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 |
line wrap: on
line diff
--- a/src/select.c Thu Dec 22 12:51:03 2011 +0000 +++ b/src/select.c Thu Dec 22 15:02:02 2011 +0000 @@ -53,6 +53,8 @@ /* A couple of Lisp functions */ Lisp_Object Qselect_convert_in, Qselect_convert_out, Qselect_coerce; +Lisp_Object Qlost_selection_hooks; + /* These are alists whose CARs are selection-types (whose names are the same as the names of X Atoms or Windows clipboard formats) and whose CDRs are the names of Lisp functions to call to convert the given Emacs selection @@ -402,20 +404,8 @@ /* Otherwise, we're really honest and truly being told to drop it. */ Vselection_alist = delq_no_quit (local_selection_data, Vselection_alist); - /* Let random lisp code notice that the selection has been stolen. - */ - { - Lisp_Object rest; - Lisp_Object val = Vlost_selection_hooks; - if (!UNBOUNDP (val) && !NILP (val)) - { - if (CONSP (val) && !EQ (XCAR (val), Qlambda)) - for (rest = val; !NILP (rest); rest = Fcdr (rest)) - call1 (Fcar (rest), selection_symbol); - else - call1 (val, selection_symbol); - } - } + /* Let random lisp code notice that the selection has been stolen. */ + va_run_hook_with_args (Qlost_selection_hooks, 1, selection_symbol); } DEFUN ("disown-selection-internal", Fdisown_selection_internal, 1, 3, 0, /* @@ -754,6 +744,8 @@ DEFSYMBOL (Qselect_convert_out); DEFSYMBOL (Qselect_coerce); + DEFSYMBOL (Qlost_selection_hooks); + /* X Atoms */ DEFSYMBOL (QPRIMARY); DEFSYMBOL (QSECONDARY); @@ -927,5 +919,5 @@ argument, a symbol naming the selection (typically PRIMARY, SECONDARY, or CLIPBOARD). */ ); - Vlost_selection_hooks = Qunbound; + Vlost_selection_hooks = Qnil; }