Function: with-work-buffer
with-work-buffer is a macro defined in compat-31.el.
Signature
(with-work-buffer &rest BODY)
Documentation
[Compatibility macro for with-work-buffer, defined in Emacs 31.0.50. See
(compat) Emacs 31.0.50' for more details.]
Create a work buffer, and evaluate BODY there like progn. Like
with-temp-buffer, but reuse an already created temporary buffer when possible,
instead of creating a new one on each call. Avoid retaining state referring to
a work buffer, and kill any indirect buffers you create that use a work buffer
as a base.
Source Code
;; Defined in ~/.emacs.d/elpa/compat-31.0.0.2/compat-31.el
(compat-defmacro with-work-buffer (&rest body) ;; <compat-tests:with-work-buffer>
"Create a work buffer, and evaluate BODY there like `progn'.
Like `with-temp-buffer', but reuse an already created temporary buffer
when possible, instead of creating a new one on each call. Avoid
retaining state referring to a work buffer, and kill any indirect
buffers you create that use a work buffer as a base."
(declare (indent 0) (debug t))
(static-if (< emacs-major-version 29)
`(with-temp-buffer ,@body)
(let ((work-buffer (make-symbol "work-buffer")))
`(let ((,work-buffer (work-buffer--get)))
(with-current-buffer ,work-buffer
(unwind-protect
(progn ,@body)
(work-buffer--release ,work-buffer)))))))