]> git.eshelyaron.com Git - emacs.git/commitdiff
Function buffer-package
authorGerd Moellmann <gerd.moellmann@gmail.com>
Tue, 5 Sep 2023 05:57:29 +0000 (07:57 +0200)
committerGerd Moellmann <gerd.moellmann@gmail.com>
Tue, 5 Sep 2023 05:57:29 +0000 (07:57 +0200)
lisp/emacs-lisp/pkg.el

index 6962421f61e8b8d4d63a4a6a71d0ed03e6c34660..9e09daf06172d64f9721731f4970d4b24a6edbd4 100644 (file)
@@ -177,13 +177,14 @@ 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.
+(cl-defun buffer-package (&optional (buffer (current-buffer)))
+  "Return the value of *package* set 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))))
+  (let ((buffer (if (bufferp buffer)
+                    buffer
+                  (get-buffer buffer))))
+    (with-current-buffer buffer
+      (default-buffer-local-value '*package*))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                                  Macros