Variable: with-editor-sleeping-editor
with-editor-sleeping-editor is a customizable variable defined in
with-editor.el.
Value
"sh -c 'printf \"\\nWITH-EDITOR: $$ OPEN $0\\037$1\\037 IN $(pwd)\\n\"; sleep 604800 & sleep=$!; trap \"kill $sleep; exit 0\" USR1; trap \"kill $sleep; exit 1\" USR2; wait $sleep'"
Documentation
The sleeping editor, used when the Emacsclient cannot be used.
This fallback is used for asynchronous processes started inside
the macro with-editor, when the process runs on a remote machine
or for local processes when with-editor-emacsclient-executable
is nil (i.e., when no suitable Emacsclient was found, or the user
decided not to use it).
Where the latter uses a socket to communicate with Emacs' server, this substitute prints edit requests to its standard output on which a process filter listens for such requests. As such it is not a complete substitute for a proper Emacsclient, it can only be used as $EDITOR of child process of the current Emacs instance.
Some shells do not execute traps immediately when waiting for a child process, but by default we do use such a blocking child process.
If you use such a shell (e.g., csh on FreeBSD, but not Debian),
then you have to edit this option. You can either replace "sh"
with "bash" (and install that), or you can use the older, less
performant implementation:
"sh -c '\\
echo -e \\"\nWITH-EDITOR: $$ OPEN $0$1 IN $(pwd)\n\"; \\
trap \\"exit 0\" USR1; \\
trap \\"exit 1" USR2; \\
while true; do sleep 1; done'"
Note that the two unit separator characters () right after $0 and $1 are required. Normally $0 is the file name and $1 is missing or else gets ignored. But if $0 has the form "+N[:N]", then it is treated as a position in the file and $1 is expected to be the file.
Also note that using this alternative implementation leads to a
delay of up to a second. The delay can be shortened by replacing
"sleep 1" with "sleep 0.01", or if your implementation does
not support floats, then by using "nanosleep" instead.
This variable was added, or its default value changed, in with-editor version 2.8.0.
Source Code
;; Defined in ~/.emacs.d/elpa/with-editor-20260301.1317/with-editor.el
(defcustom with-editor-sleeping-editor "\
sh -c '\
printf \"\\nWITH-EDITOR: $$ OPEN $0\\037$1\\037 IN $(pwd)\\n\"; \
sleep 604800 & sleep=$!; \
trap \"kill $sleep; exit 0\" USR1; \
trap \"kill $sleep; exit 1\" USR2; \
wait $sleep'"
"The sleeping editor, used when the Emacsclient cannot be used.
This fallback is used for asynchronous processes started inside
the macro `with-editor', when the process runs on a remote machine
or for local processes when `with-editor-emacsclient-executable'
is nil (i.e., when no suitable Emacsclient was found, or the user
decided not to use it).
Where the latter uses a socket to communicate with Emacs' server,
this substitute prints edit requests to its standard output on
which a process filter listens for such requests. As such it is
not a complete substitute for a proper Emacsclient, it can only
be used as $EDITOR of child process of the current Emacs instance.
Some shells do not execute traps immediately when waiting for a
child process, but by default we do use such a blocking child
process.
If you use such a shell (e.g., `csh' on FreeBSD, but not Debian),
then you have to edit this option. You can either replace \"sh\"
with \"bash\" (and install that), or you can use the older, less
performant implementation:
\"sh -c '\\
echo -e \\\"\\nWITH-EDITOR: $$ OPEN $0$1 IN $(pwd)\\n\\\"; \\
trap \\\"exit 0\\\" USR1; \\
trap \\\"exit 1\" USR2; \\
while true; do sleep 1; done'\"
Note that the two unit separator characters () right after $0
and $1 are required. Normally $0 is the file name and $1 is
missing or else gets ignored. But if $0 has the form \"+N[:N]\",
then it is treated as a position in the file and $1 is expected
to be the file.
Also note that using this alternative implementation leads to a
delay of up to a second. The delay can be shortened by replacing
\"sleep 1\" with \"sleep 0.01\", or if your implementation does
not support floats, then by using \"nanosleep\" instead."
:package-version '(with-editor . "2.8.0")
:group 'with-editor
:type 'string)