emacs-diffs
[Top][All Lists]
Advanced

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

scratch/pkg 1ef4332bdcb 1/2: Execute commands in the Emacs package


From: Gerd Moellmann
Subject: scratch/pkg 1ef4332bdcb 1/2: Execute commands in the Emacs package
Date: Mon, 4 Sep 2023 04:48:42 -0400 (EDT)

branch: scratch/pkg
commit 1ef4332bdcb349b40d5984bf8154246c66c3604d
Author: Gerd Moellmann <gerd.moellmann@gmail.com>
Commit: Gerd Moellmann <gerd.moellmann@gmail.com>

    Execute commands in the Emacs package
    
    * lisp/emacs-lisp/pkg.el (buffer-package): New function.
    * lisp/simple.el (command-execute): Bind *package* to the Emacs
    package.
---
 lisp/emacs-lisp/pkg.el | 7 +++++++
 lisp/simple.el         | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/pkg.el b/lisp/emacs-lisp/pkg.el
index 8e9cba049c6..494cf0eb437 100644
--- a/lisp/emacs-lisp/pkg.el
+++ b/lisp/emacs-lisp/pkg.el
@@ -172,6 +172,13 @@ Otherwise assume that "
       (error "%s does not contain a symbol %s"
              (package-name package) name))))
 
+(defun buffer-package (buffer)
+  "Return the value of *package* in BUFFER.
+BUFFER must be either a buffer object or the name of an existing buffer."
+  (buffer-local-value '*package*
+                     (if (bufferp buffer)
+                         buffer
+                       (get-buffer buffer))))
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                  Macros
diff --git a/lisp/simple.el b/lisp/simple.el
index 05a3c4b93d6..14bbcbab60d 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2769,7 +2769,8 @@ The argument SPECIAL, if non-nil, means that this command 
is
 executing a special event, so ignore the prefix argument and
 don't clear it."
   (setq debug-on-next-call nil)
-  (let ((prefixarg (unless special
+  (let ((*package* *emacs-package*)
+        (prefixarg (unless special
                      ;; FIXME: This should probably be done around
                      ;; pre-command-hook rather than here!
                      (prog1 prefix-arg



reply via email to

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