=== modified file 'src/keyboard.c' --- src/keyboard.c 2014-07-27 13:21:30 +0000 +++ src/keyboard.c 2014-08-01 10:44:22 +0000 @@ -1852,30 +1852,32 @@ } } -/* Subroutine for safe_run_hooks: run the hook HOOK. */ +/* Subroutine for safe_run_hooks: run the hook, which is ARGS[1]. */ static Lisp_Object -safe_run_hooks_1 (void) +safe_run_hooks_1 (ptrdiff_t nargs, Lisp_Object *args) { - eassert (CONSP (Vinhibit_quit)); - return call0 (XCDR (Vinhibit_quit)); + eassert (nargs == 2); + return call0 (args[1]); } /* Subroutine for safe_run_hooks: handle an error by clearing out the function from the hook. */ static Lisp_Object -safe_run_hooks_error (Lisp_Object error_data) +safe_run_hooks_error (Lisp_Object error, ptrdiff_t nargs, Lisp_Object *args) { - Lisp_Object hook - = CONSP (Vinhibit_quit) ? XCAR (Vinhibit_quit) : Vinhibit_quit; - Lisp_Object fun = CONSP (Vinhibit_quit) ? XCDR (Vinhibit_quit) : Qnil; - Lisp_Object args[4]; - args[0] = build_string ("Error in %s (%S): %S"); - args[1] = hook; - args[2] = fun; - args[3] = error_data; - Fmessage (4, args); + Lisp_Object hook, fun, msgargs[4]; + + eassert (nargs == 2); + hook = args[0]; + fun = args[1]; + msgargs[0] = build_string ("Error in %s (%S): %S"); + msgargs[1] = hook; + msgargs[2] = fun; + msgargs[3] = error; + Fmessage (4, msgargs); + if (SYMBOLP (hook)) { Lisp_Object val; @@ -1907,14 +1909,19 @@ static Lisp_Object safe_run_hook_funcall (ptrdiff_t nargs, Lisp_Object *args) { + Lisp_Object iargs[2]; + struct gcpro gcpro1; + eassert (nargs == 1); - if (CONSP (Vinhibit_quit)) - XSETCDR (Vinhibit_quit, args[0]); - else - Vinhibit_quit = Fcons (Vinhibit_quit, args[0]); - - internal_condition_case (safe_run_hooks_1, Qt, safe_run_hooks_error); - return Qnil; + iargs[0] = Vinhibit_quit; + 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); } /* If we get an error while running the hook, cause the hook variable @@ -1924,9 +1931,6 @@ void safe_run_hooks (Lisp_Object hook) { - /* FIXME: our `internal_condition_case' does not provide any way to pass data - to its body or to its handlers other than via globals such as - dynamically-bound variables ;-) */ ptrdiff_t count = SPECPDL_INDEX (); specbind (Qinhibit_quit, hook);