summaryrefslogtreecommitdiff
path: root/doc/emacs/misc.texi
diff options
context:
space:
mode:
authorGregory Heytings <gregory@heytings.org>2021-11-11 06:43:10 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2021-11-11 06:43:10 +0100
commit894dd18804ef766a87ffa4b4109125b4661651be (patch)
tree41379cb51bdc0f1a8d949b6988e93c7dd3bae4c5 /doc/emacs/misc.texi
parent0a93fb499b8885ffd87338f1ccc9cb5093f567c1 (diff)
downloademacs-894dd18804ef766a87ffa4b4109125b4661651be.tar.gz
Options to automatically stop the Emacs server
* doc/emacs/misc.texi (Emacs Server): Document the new function. Also mention that an Emacs server can be started with emacsclient. * etc/NEWS: Describe the new function (bug#51377). * lisp/server.el (server-stop-automatically): New function. (server-stop-automatically): New auxiliary variable. (server-stop-automatically--maybe-kill-emacs) (server-stop-automatically--handle-delete-frame): New auxiliary functions. (server-save-buffers-kill-terminal): Call the new auxiliary function when necessary.
Diffstat (limited to 'doc/emacs/misc.texi')
-rw-r--r--doc/emacs/misc.texi31
1 files changed, 31 insertions, 0 deletions
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 4b3c2ea4bd2..3d423d7675b 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -1703,6 +1703,11 @@ options. @xref{Initial Options}. When Emacs is started this way, it
calls @code{server-start} after initialization and does not open an
initial frame. It then waits for edit requests from clients.
+@item
+Run the command @code{emacsclient} with the @samp{--alternate-editor=""}
+command-line option. This starts an Emacs daemon only if no Emacs daemon
+is already running.
+
@cindex systemd unit file
@item
If your operating system uses @command{systemd} to manage startup,
@@ -1769,6 +1774,32 @@ you can give each daemon its own server name like this:
emacs --daemon=foo
@end example
+@findex server-stop-automatically
+ The Emacs server can optionally be stopped automatically when
+certain conditions are met. To do this, call the function
+@code{server-stop-automatically} in your init file (@pxref{Init
+File}), with one of the following arguments:
+
+@itemize
+@item
+With the argument @code{empty}, the server is stopped when it has no
+clients, no unsaved file-visiting buffers and no running processes
+anymore.
+
+@item
+With the argument @code{delete-frame}, when the last client frame is
+being closed, you are asked whether each unsaved file-visiting buffer
+must be saved and each unfinished process can be stopped, and if so,
+the server is stopped.
+
+@item
+With the argument @code{kill-terminal}, when the last client frame is
+being closed with @kbd{C-x C-c} (@code{save-buffers-kill-terminal}),
+you are asked whether each unsaved file-visiting buffer must be saved
+and each unfinished process can be stopped, and if so, the server is
+stopped.
+@end itemize
+
@findex server-eval-at
If you have defined a server by a unique server name, it is possible
to connect to the server from another Emacs instance and evaluate Lisp