Function: magit--with-temp-process-buffer

magit--with-temp-process-buffer is a macro defined in magit-git.el.

Signature

(magit--with-temp-process-buffer &rest BODY)

Documentation

Like with-temp-buffer, but propagate process-environment binding.

When that variable is buffer-local in the previously current buffer, it is not propagated by with-temp-buffer, so we explicitly ensure that happens, so that processes are invoked consistently. BODY is as for that macro.

Note that itself Magit does not ever make this variable buffer-local. This macro only exists to cope with third-party code doing that.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20261101.2154/magit-git.el
(defmacro magit--with-temp-process-buffer (&rest body)
  "Like `with-temp-buffer', but propagate `process-environment' binding.

When that variable is buffer-local in the previously current buffer,
it is not propagated by `with-temp-buffer', so we explicitly ensure
that happens, so that processes are invoked consistently.  BODY is
as for that macro.

Note that itself Magit does not ever make this variable buffer-local.
This macro only exists to cope with third-party code doing that."
  (declare (indent 0) (debug (body)))
  (let ((p (gensym)))
    `(let ((,p process-environment))
       (with-temp-buffer
         (let ((process-environment ,p))
           ,@body)))))