Function: with-editor

with-editor is a macro defined in with-editor.el.

Signature

(with-editor [ENVVAR] BODY...)

Documentation

Use the Emacsclient as $EDITOR while evaluating BODY.

Modify the process-environment for processes started in BODY, instructing them to use the Emacsclient as $EDITOR. If optional ENVVAR is a literal string then bind that environment variable instead.

Source Code

;; Defined in ~/.emacs.d/elpa/with-editor-20260301.1317/with-editor.el
(defmacro with-editor (&rest body)
  "Use the Emacsclient as $EDITOR while evaluating BODY.
Modify the `process-environment' for processes started in BODY,
instructing them to use the Emacsclient as $EDITOR.  If optional
ENVVAR is a literal string then bind that environment variable
instead.
\n(fn [ENVVAR] BODY...)"
  (declare (indent defun) (debug (body)))
  `(let ((with-editor--envvar ,(if (stringp (car body))
                                   (pop body)
                                 '(or with-editor--envvar "EDITOR")))
         (process-environment process-environment))
     (with-editor--setup)
     ,@body))