From: Gerd Moellmann Date: Tue, 5 Sep 2023 05:57:29 +0000 (+0200) Subject: Function buffer-package X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9c08f0d108dc948a575db68da9548bfba515187a;p=emacs.git Function buffer-package --- diff --git a/lisp/emacs-lisp/pkg.el b/lisp/emacs-lisp/pkg.el index 6962421f61e..9e09daf0617 100644 --- a/lisp/emacs-lisp/pkg.el +++ b/lisp/emacs-lisp/pkg.el @@ -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