From ff5a3c74fc45c80f2c8c272f259dbba84b7c3f66 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 7 Dec 2020 13:53:24 +0100 Subject: [PATCH] Allow inhibiting the instructions on how to close emacsclient frames * doc/emacs/misc.texi (Invoking emacsclient): Document it. * lisp/server.el (server-client-instructions): New variable. (server-execute): Use it. --- doc/emacs/misc.texi | 6 ++++++ etc/NEWS | 8 ++++++++ lisp/server.el | 20 +++++++++++++++----- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 5b5134b7c3f..e0341a49913 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -1893,6 +1893,12 @@ with @kbd{C-x #}. But @kbd{C-x #} is the way to tell window or a frame, @kbd{C-x #} always displays the next server buffer in that window or in that frame. +@vindex server-client-instructions + When @command{emacsclient} connects, the server will normally output +a message that says how to exit the client frame. If +@code{server-client-instructions} is set to @code{nil}, this message +is inhibited. + @node emacsclient Options @subsection @code{emacsclient} Options @cindex @code{emacsclient} options diff --git a/etc/NEWS b/etc/NEWS index a30355f20db..34f7d30c845 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -287,6 +287,14 @@ the buffer cycles the whole buffer between "only top-level headings", * Changes in Specialized Modes and Packages in Emacs 28.1 +** Emacs Server + ++++ +*** New user option 'server-client-instructions'. +When emacsclient connects, Emacs will (by default) output a message +about how to exit the client frame. If 'server-client-instructions' +is set to nil, this message is inhibited. + ** Python mode *** 'C-c C-r' can now be used on arbitrary regions. diff --git a/lisp/server.el b/lisp/server.el index 2fd94552dda..b1b27e33b2e 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -268,6 +268,12 @@ the \"-f\" switch otherwise." :type 'string :version "23.1") +(defcustom server-client-instructions t + "If non-nil, output instructions on how to exit the client on connection. +If non, no messaging is done." + :version "28.1" + :type 'boolean) + ;; We do not use `temporary-file-directory' here, because emacsclient ;; does not read the init file. (defvar server-socket-dir @@ -1360,8 +1366,10 @@ The following commands are accepted by the client: nil) ((and frame (null buffers)) (run-hooks 'server-after-make-frame-hook) - (message "%s" (substitute-command-keys - "When done with this frame, type \\[delete-frame]"))) + (when server-client-instructions + (message "%s" + (substitute-command-keys + "When done with this frame, type \\[delete-frame]")))) ((not (null buffers)) (run-hooks 'server-after-make-frame-hook) (server-switch-buffer @@ -1372,9 +1380,11 @@ The following commands are accepted by the client: ;; where it may be displayed. (plist-get (process-plist proc) 'frame)) (run-hooks 'server-switch-hook) - (unless nowait - (message "%s" (substitute-command-keys - "When done with a buffer, type \\[server-edit]"))))) + (when (and (not nowait) + server-client-instructions) + (message "%s" + (substitute-command-keys + "When done with a buffer, type \\[server-edit]"))))) (when (and frame (null tty-name)) (server-unselect-display frame))) ((quit error) -- 2.39.5