From: Gerd Möllmann Date: Mon, 2 Oct 2023 09:04:22 +0000 (+0200) Subject: Bind *package* in hooks X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=99cebef7258d9aaaed1af66e98856ce9963cddbd;p=emacs.git Bind *package* in hooks * src/eval.c (run_hook_with_args): Bind *package* to the emacs package. --- diff --git a/src/eval.c b/src/eval.c index 4d247556264..68a30631fb0 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2853,10 +2853,16 @@ run_hook_with_args (ptrdiff_t nargs, Lisp_Object *args, if (BASE_EQ (val, Qunbound) || NILP (val)) return ret; - else if (!CONSP (val) || FUNCTIONP (val)) + + specpdl_ref count = SPECPDL_INDEX (); + specbind (Qearmuffs_package, Vemacs_package); + + if (!CONSP (val) || FUNCTIONP (val)) { args[0] = val; - return funcall (nargs, args); + const Lisp_Object ret = funcall (nargs, args); + unbind_to (count, Qnil); + return ret; } else { @@ -2899,6 +2905,7 @@ run_hook_with_args (ptrdiff_t nargs, Lisp_Object *args, } } + unbind_to (count, Qnil); return ret; } }