(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