]> git.eshelyaron.com Git - emacs.git/commitdiff
* keyboard.c (safe_run_hooks): Follow the convenient style to bind
authorDmitry Antipov <dmantipov@yandex.ru>
Tue, 5 Aug 2014 05:43:35 +0000 (09:43 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Tue, 5 Aug 2014 05:43:35 +0000 (09:43 +0400)
inhibit-quit to t and pass 2 args to safe_run_hook_funcall.  See
<http://lists.gnu.org/archive/html/emacs-devel/2014-08/msg00077.html>.
(safe_run_hook_funcall): Adjust accordingly.

src/ChangeLog
src/keyboard.c

index e936863ce1d0e52a86336ceeb30a01a7c1f95819..d08cf69af8e9fed75f4d6238471cf842ea7ed99f 100644 (file)
@@ -1,3 +1,10 @@
+2014-08-05 Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * keyboard.c (safe_run_hooks): Follow the convenient style to bind
+       inhibit-quit to t and pass 2 args to safe_run_hook_funcall.  See
+       <http://lists.gnu.org/archive/html/emacs-devel/2014-08/msg00077.html>.
+       (safe_run_hook_funcall): Adjust accordingly.
+
 2014-08-04  Martin Rudalics  <rudalics@gmx.at>
 
        * frame.h (FRAME_HAS_HORIZONTAL_SCROLL_BARS): Condition
index dd7e084783d19f8ac70d0cb9f9d14b643e3dd7c1..8a6385301c46a481e29eb33b9eaf25ccaea1d17e 100644 (file)
@@ -1910,18 +1910,14 @@ static Lisp_Object
 safe_run_hook_funcall (ptrdiff_t nargs, Lisp_Object *args)
 {
   Lisp_Object iargs[2];
-  struct gcpro gcpro1;
 
-  eassert (nargs == 1);
-  iargs[0] = Vinhibit_quit;
+  eassert (nargs == 2);
+  /* Yes, run_hook_with_args works this way.  */
+  iargs[0] = args[1];
   iargs[1] = args[0];
-
-  GCPRO1 (*iargs);
-  gcpro1.nvars = 2;
-
   internal_condition_case_n (safe_run_hooks_1, 2, iargs,
                             Qt, safe_run_hooks_error);
-  RETURN_UNGCPRO (Qnil);
+  return Qnil;
 }
 
 /* If we get an error while running the hook, cause the hook variable
@@ -1931,11 +1927,18 @@ safe_run_hook_funcall (ptrdiff_t nargs, Lisp_Object *args)
 void
 safe_run_hooks (Lisp_Object hook)
 {
+  Lisp_Object args[2];
+  struct gcpro gcpro1;
   ptrdiff_t count = SPECPDL_INDEX ();
 
-  specbind (Qinhibit_quit, hook);
-  run_hook_with_args (1, &hook, safe_run_hook_funcall);
+  args[0] = hook;
+  args[1] = hook;
+
+  GCPRO1 (hook);
+  specbind (Qinhibit_quit, Qt);
+  run_hook_with_args (2, args, safe_run_hook_funcall);
   unbind_to (count, Qnil);
+  UNGCPRO;
 }
 
 \f