From: Gerd Moellmann Date: Mon, 4 Sep 2023 07:47:04 +0000 (+0200) Subject: Execute commands in the Emacs package X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1ef4332bdcb349b40d5984bf8154246c66c3604d;p=emacs.git 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. --- 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