changeset 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 5f4f92a31875
children b0d712bbc2a6
files src/ChangeLog src/select-gtk.c src/select-x.c src/select.c
diffstat 4 files changed, 29 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Dec 22 12:51:03 2011 +0000
+++ b/src/ChangeLog	Thu Dec 22 15:02:02 2011 +0000
@@ -1,3 +1,17 @@
+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.
+
 2011-12-22  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* eval.c (Fmacroexpand): Rename Fmacroexpand_internal, add the
--- a/src/select-gtk.c	Thu Dec 22 12:51:03 2011 +0000
+++ b/src/select-gtk.c	Thu Dec 22 15:02:02 2011 +0000
@@ -508,5 +508,5 @@
 This hook doesn't let you change the behavior of emacs's selection replies,
 it merely informs you that they have happened.
 */ );
-  Vgtk_sent_selection_hooks = Qunbound;
+  Vgtk_sent_selection_hooks = Qnil;
 }
--- a/src/select-x.c	Thu Dec 22 12:51:03 2011 +0000
+++ b/src/select-x.c	Thu Dec 22 15:02:02 2011 +0000
@@ -64,6 +64,8 @@
 
 Lisp_Object Vx_sent_selection_hooks;
 
+Lisp_Object Qx_sent_selection_hooks;
+
 /* If this is a smaller number than the max-request-size of the display,
    emacs will use INCR selection transfer when the selection is larger
    than this.  The max-request-size is usually around 64k, so if you want
@@ -700,18 +702,8 @@
   UNGCPRO;
 
   /* Let random lisp code notice that the selection has been asked for. */
-  {
-    Lisp_Object val = Vx_sent_selection_hooks;
-    if (!UNBOUNDP (val) && !NILP (val))
-      {
-	Lisp_Object rest;
-	if (CONSP (val) && !EQ (XCAR (val), Qlambda))
-	  for (rest = val; !NILP (rest); rest = Fcdr (rest))
-	    call3 (Fcar (rest), selection_symbol, target_symbol, successful_p);
-	else
-	  call3 (val, selection_symbol, target_symbol, successful_p);
-      }
-  }
+  va_run_hook_with_args (Qx_sent_selection_hooks, 3, selection_symbol,
+                         target_symbol, successful_p);
 }
 
 
@@ -1502,6 +1494,8 @@
   DEFSUBR (Fx_rotate_cutbuffers_internal);
 #endif /* CUT_BUFFER_SUPPORT */
 
+  DEFSYMBOL (Qx_sent_selection_hooks);
+
   /* Unfortunately, timeout handlers must be lisp functions. */
   DEFSYMBOL (Qx_selection_reply_timeout_internal);
   DEFSUBR (Fx_selection_reply_timeout_internal);
@@ -1559,7 +1553,7 @@
 This hook doesn't let you change the behavior of emacs's selection replies,
 it merely informs you that they have happened.
 */ );
-  Vx_sent_selection_hooks = Qunbound;
+  Vx_sent_selection_hooks = Qnil;
 
   DEFVAR_INT ("x-selection-timeout", &x_selection_timeout /*
 If the selection owner doesn't reply in this many seconds, we give up.
--- 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;
 }