summaryrefslogtreecommitdiff
path: root/doc/emacs/misc.texi
diff options
context:
space:
mode:
Diffstat (limited to 'doc/emacs/misc.texi')
-rw-r--r--doc/emacs/misc.texi58
1 files changed, 51 insertions, 7 deletions
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index a1f611cfb23..2290dec31e2 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -771,6 +771,14 @@ the output buffer. But if you change the value of the variable
@code{shell-command-default-error-buffer} to a string, error output is
inserted into a buffer of that name.
+@vindex shell-command-dont-erase-buffer
+ By default, the output buffer is erased between shell commands.
+If you change the value of the variable
+@code{shell-command-dont-erase-buffer} to a non-@code{nil} value,
+the output buffer is not erased. This variable also controls where to
+set the point in the output buffer after the command completes; see the
+documentation of the variable for details.
+
@node Interactive Shell
@subsection Interactive Subshell
@@ -1562,7 +1570,7 @@ process.
You can solve this problem by setting up Emacs as an @dfn{edit
server}, so that it ``listens'' for external edit requests and acts
-accordingly. There are two ways to start an Emacs server:
+accordingly. There are various ways to start an Emacs server:
@itemize
@findex server-start
@@ -1575,15 +1583,51 @@ dies with the Emacs process.
@cindex daemon, Emacs
@item
-Run Emacs as a @dfn{daemon}, using the @samp{--daemon} command-line
-option. @xref{Initial Options}. When Emacs is started this way, it
-calls @code{server-start} after initialization, and returns control to
-the calling terminal instead of opening an initial frame; it then
-waits in the background, listening for edit requests.
+Run Emacs as a @dfn{daemon}, using one of the @samp{--daemon} command-line
+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.
+
+@cindex systemd unit file
+@item
+If your operating system uses @command{systemd} to manage startup,
+you can automatically start Emacs in daemon mode when you login
+using the supplied @dfn{systemd unit file}. To activate this:
+@example
+systemctl --user enable emacs
+@end example
+(If your Emacs was installed into a non-standard location, you may
+need to copy the @file{emacs.service} file to a standard directory
+such as @file{~/.config/systemd/user/}.)
+
+@cindex socket activation, systemd, Emacs
+@item
+An external process can invoke the Emacs server when a connection
+event occurs upon a specified socket and pass the socket to the new
+Emacs server process. An instance of this is the socket functionality
+of @command{systemd}: the @command{systemd} service creates a socket and
+listens for connections on it; when @command{emacsclient} connects to
+it for the first time, @command{systemd} can launch the Emacs server
+and hand over the socket to it for servicing @command{emacsclient}
+connections. A setup to use this functionality could be:
+
+@file{~/.config/systemd/user/emacs.socket}:
+@example
+[Socket]
+ListenStream=/path/to/.emacs.socket
+
+[Install]
+WantedBy=sockets.target
+@end example
+
+(The @file{emacs.service} file described above must also be installed.)
+
+The @code{ListenStream} path will be the path that Emacs listens for
+connections from @command{emacsclient}; this is a file of your choice.
@end itemize
@cindex @env{TEXEDIT} environment variable
- Either way, once an Emacs server is started, you can use a shell
+ Once an Emacs server is started, you can use a shell
command called @command{emacsclient} to connect to the Emacs process
and tell it to visit a file. You can then set the @env{EDITOR}
environment variable to @samp{emacsclient}, so that external programs