emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/pkg 99cebef7258: Bind *package* in hooks


From: Gerd Moellmann
Subject: scratch/pkg 99cebef7258: Bind *package* in hooks
Date: Mon, 2 Oct 2023 05:05:16 -0400 (EDT)

branch: scratch/pkg
commit 99cebef7258d9aaaed1af66e98856ce9963cddbd
Author: Gerd Möllmann <gerd@gnu.org>
Commit: Gerd Möllmann <gerd@gnu.org>

    Bind *package* in hooks
    
    * src/eval.c (run_hook_with_args): Bind *package* to the emacs
    package.
---
 src/eval.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

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;
     }
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]