Function: package--with-work-buffer

package--with-work-buffer is a macro defined in package.el.gz.

This macro is obsolete since 25.1; use package--with-response-buffer instead.

Signature

(package--with-work-buffer LOCATION FILE &rest BODY)

Documentation

Run BODY in a buffer containing the contents of FILE at LOCATION.

LOCATION is the base location of a package archive, and should be one of the URLs (or file names) specified in package-archives. FILE is the name of a file relative to that base location.

This macro retrieves FILE from LOCATION into a temporary buffer, and evaluates BODY while that buffer is current. This work buffer is killed afterwards. Return the last value in BODY.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/package.el.gz
(defmacro package--with-work-buffer (location file &rest body)
  "Run BODY in a buffer containing the contents of FILE at LOCATION.
LOCATION is the base location of a package archive, and should be
one of the URLs (or file names) specified in `package-archives'.
FILE is the name of a file relative to that base location.

This macro retrieves FILE from LOCATION into a temporary buffer,
and evaluates BODY while that buffer is current.  This work
buffer is killed afterwards.  Return the last value in BODY."
  (declare (indent 2) (debug t)
           (obsolete package--with-response-buffer "25.1"))
  `(with-temp-buffer
     (if (string-match-p "\\`https?:" ,location)
         (url-insert-file-contents (concat ,location ,file))
       (unless (file-name-absolute-p ,location)
         (error "Archive location %s is not an absolute file name"
           ,location))
       (insert-file-contents (expand-file-name ,file ,location)))
     ,@body))