Function: with-editor-mode
with-editor-mode is a byte-compiled function defined in
with-editor.el.
Signature
(with-editor-mode &optional ARG)
Documentation
Edit a file as the $EDITOR of an external process.
This is a minor mode. If called interactively, toggle the With-Editor
mode mode. If the prefix argument is positive, enable the mode, and if
it is zero or negative, disable the mode.
If called from Lisp, toggle the mode if ARG is toggle. Enable the
mode if ARG is nil, omitted, or is a positive number. Disable the mode
if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate the variable with-editor-mode(var)/with-editor-mode(fun).
The mode's hook is called both when the mode is enabled and when it is disabled.
Source Code
;; Defined in ~/.emacs.d/elpa/with-editor-20260301.1317/with-editor.el
(define-minor-mode with-editor-mode
"Edit a file as the $EDITOR of an external process."
:lighter with-editor-mode-lighter
;; Protect the user from enabling or disabling the mode interactively.
;; Manually enabling the mode is dangerous because canceling the buffer
;; deletes the visited file. The mode must not be disabled manually,
;; either `with-editor-finish' or `with-editor-cancel' must be used.
:interactive nil ; >= 28.1
(when (called-interactively-p 'any) ; < 28.1
(setq with-editor-mode (not with-editor-mode))
(user-error "With-Editor mode is not intended for interactive use"))
;; The buffer must also not be killed using regular kill commands.
(add-hook 'kill-buffer-query-functions
#'with-editor-kill-buffer-noop nil t)
;; `server-execute' displays a message which is not
;; correct when using this mode.
(when with-editor-show-usage
(with-editor-usage-message)))