Function: with-editor-async-shell-command

with-editor-async-shell-command is an autoloaded, interactive and byte-compiled function defined in with-editor.el.

Signature

(with-editor-async-shell-command COMMAND &optional OUTPUT-BUFFER ERROR-BUFFER ENVVAR)

Documentation

Like async-shell-command but with $EDITOR set.

Execute string "ENVVAR=CLIENT COMMAND" in an inferior shell; display output, if any. With a prefix argument prompt for an environment variable, otherwise the default "EDITOR" variable is used. With a negative prefix argument additionally insert the COMMAND's output at point.

CLIENT is automatically generated; ENVVAR=CLIENT instructs COMMAND to use to the current Emacs instance as "the editor", assuming it respects ENVVAR as an "EDITOR"-like variable. CLIENT may be the path to an appropriate emacsclient executable with arguments, or a script which also works over Tramp.

Also see async-shell-command and shell-command.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/with-editor-20260301.1317/with-editor.el
;;;###autoload
(defun with-editor-async-shell-command
    (command &optional output-buffer error-buffer envvar)
  "Like `async-shell-command' but with `$EDITOR' set.

Execute string \"ENVVAR=CLIENT COMMAND\" in an inferior shell;
display output, if any.  With a prefix argument prompt for an
environment variable, otherwise the default \"EDITOR\" variable
is used.  With a negative prefix argument additionally insert
the COMMAND's output at point.

CLIENT is automatically generated; ENVVAR=CLIENT instructs
COMMAND to use to the current Emacs instance as \"the editor\",
assuming it respects ENVVAR as an \"EDITOR\"-like variable.
CLIENT may be the path to an appropriate emacsclient executable
with arguments, or a script which also works over Tramp.

Also see `async-shell-command' and `shell-command'."
  (interactive (with-editor-shell-command-read-args "Async shell command: " t))
  (let ((with-editor--envvar envvar))
    (with-editor
      (async-shell-command command output-buffer error-buffer))))