with-editor 
- Description
- Use the Emacsclient as $EDITOR
- Latest
- with-editor-3.4.7.0.20251101.210014.tar (.sig), 2025-Nov-02, 100 KiB
- Maintainer
- Jonas Bernoulli <emacs.with-editor@jonas.bernoulli.dev>
- Website
- https://github.com/magit/with-editor
- Browse ELPA's repository
- CGit or Gitweb
- Badge
- Manual
- with-editor
To install this package from Emacs, use package-install or list-packages.
Full description
1. With-Editor
This library makes it possible to reliably use the Emacsclient as
the $EDITOR of child processes. It makes sure that they know how
to call home. For remote processes a substitute is provided, which
communicates with Emacs on standard output/input instead of using a
socket as the Emacsclient does.
It provides the commands with-editor-async-shell-command and
with-editor-shell-command, which are intended as replacements
for async-shell-command and shell-command. They automatically
export $EDITOR making sure the executed command uses the current
Emacs instance as "the editor". With a prefix argument these
commands prompt for an alternative environment variable such as
$GIT_EDITOR. To always use these variants add this to your init
file:
(keymap-global-set "<remap> <async-shell-command>" #'with-editor-async-shell-command) (keymap-global-set "<remap> <shell-command>" #'with-editor-shell-command)
Alternatively use the global shell-command-with-editor-mode,
which always sets $EDITOR for all Emacs commands which ultimately
use shell-command to asynchronously run some shell command.
The command with-editor-export-editor exports $EDITOR or
another such environment variable in shell-mode, eshell-mode,
term-mode and vterm-mode buffers. Use this Emacs command
before executing a shell command which needs the editor set, or
always arrange for the current Emacs instance to be used as editor
by adding it to the appropriate mode hooks:
(add-hook 'shell-mode-hook 'with-editor-export-editor) (add-hook 'eshell-mode-hook 'with-editor-export-editor) (add-hook 'term-exec-hook 'with-editor-export-editor) (add-hook 'vterm-mode-hook 'with-editor-export-editor)
Some variants of this function exist, these two forms are equivalent:
(add-hook 'shell-mode-hook (apply-partially 'with-editor-export-editor "GIT_EDITOR")) (add-hook 'shell-mode-hook 'with-editor-export-git-editor)
This library can also be used by other packages which need to use
the current Emacs instance as editor. In fact this library was
written for Magit and its git-commit-mode and git-rebase-mode.
Consult git-rebase.el and the related code in magit-sequence.el
for a simple example.
Old versions
| with-editor-3.4.6.0.20251030.222848.tar.lz | 2025-Oct-31 | 17.7 KiB |
| with-editor-3.4.6.0.20250901.161817.tar.lz | 2025-Sep-01 | 17.7 KiB |
| with-editor-3.4.5.0.20250829.153220.tar.lz | 2025-Aug-29 | 17.6 KiB |
| with-editor-3.4.5.0.20250801.115254.tar.lz | 2025-Aug-01 | 21.6 KiB |
| with-editor-3.4.4.0.20250724.84316.tar.lz | 2025-Jul-24 | 21.6 KiB |
| with-editor-3.4.1.0.20240830.222853.tar.lz | 2024-Aug-31 | 21.2 KiB |
| with-editor-3.3.4.0.20240713.193157.tar.lz | 2024-Jul-13 | 20.7 KiB |
| with-editor-3.2.0.50snapshot0.20230412.105315.tar.lz | 2023-Apr-12 | 20.7 KiB |
| with-editor-3.1.1.0.20220126.133910.tar.lz | 2022-Jan-26 | 19.3 KiB |
| with-editor-3.0.5.0.20220101.131650.tar.lz | 2022-Jan-01 | 29.6 KiB |
News
# -*- mode: org -*- * v3.4.7 2025-11-01 - Thoughts and whitespace. * v3.4.6 2025-09-01 - Thoughts and whitespace. * v3.4.5 2025-08-01 - No longer add "clear" to the shell's history when using vterm. #135 * v3.4.4 2025-06-01 - Added kludge for Nix on macOS. #134 * v3.4.3 2024-12-01 - Added new variable ~with-editor-emacsclient-program-suffixes~. #132 * v3.4.2 2024-09-01 - Fixed ~shell-command-with-editor-mode~ for remote processes. #129 - ~with-editor-export-editor~ now waits longer for the terminal to get ready. #130 - Updated tooling.