From 8804c97495a4b210447ce6195956526017f4d188 Mon Sep 17 00:00:00 2001 From: Matthew Leach Date: Sat, 26 Mar 2016 20:43:26 +0000 Subject: [PATCH v3 4/4] When Emacs is passed a socket descriptor, make the server listen on it. * lisp/server.el (server-start): Set :use-systemd-socket to `t' when calling `make-network-process'. * etc/NEWS: Document new systemd functionality and build option to disable it. * doc/emacs/misc.texi (Emacs Server): Document systemd socket passing functionality. squash! When Emacs is passed a socket descriptor, make the server listen on it. --- doc/emacs/misc.texi | 9 +++++++++ etc/NEWS | 7 +++++++ lisp/server.el | 1 + 3 files changed, 17 insertions(+) diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index b5a2150..d805648 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -1580,6 +1580,15 @@ 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. + +@cindex socket activation, systemd, Emacs +@item +If Emacs has been built with @command{systemd} support, the Emacs +server can be started by socket activation. 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 hands over the +socket to it for servicing @command{emacsclient} connections. @end itemize @cindex @env{TEXEDIT} environment variable diff --git a/etc/NEWS b/etc/NEWS index 66777e9..9afed5b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -26,6 +26,13 @@ otherwise leave it unmarked. * Installation Changes in Emacs 25.2 +++ +** Emacs now has systemd support. This allows socket based +activation, where systemd can invoke the Emacs process upon a +socket connection and hand over the socket to Emacs. Emacs will +use this socket for communicating with the emacsclient program. +This can be disabled with the new configure option +'--disable-systemd'. + ** New configure option '--disable-build-details' attempts to build an Emacs that is more likely to be reproducible; that is, if you build and install Emacs twice, the second Emacs is a copy of the first. diff --git a/lisp/server.el b/lisp/server.el index 5243820..2c9113c 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -655,6 +655,7 @@ server or call `\\[server-force-delete]' to forcibly disconnect it.")) :noquery t :sentinel #'server-sentinel :filter #'server-process-filter + :use-systemd-socket t ;; We must receive file names without being decoded. ;; Those are decoded by server-process-filter according ;; to file-name-coding-system. Also don't get -- 2.7.4