summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/emacs/misc.texi4
-rw-r--r--doc/man/emacsclient.11
-rw-r--r--etc/NEWS6
-rw-r--r--lib-src/emacsclient.c3
4 files changed, 14 insertions, 0 deletions
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 236cb07785c..ab33cafb8e8 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -1966,6 +1966,10 @@ is given by the variable @code{server-name} on the Emacs server. If
this option is omitted, @command{emacsclient} connects to the first
server it finds. (This option is not supported on MS-Windows.)
+Alternatively, you can set the @env{EMACS_SOCKET_NAME} environment
+variable to point to the server socket. (The command-line option
+overrides the environment variable.)
+
@item -t
@itemx --tty
@itemx -nw
diff --git a/doc/man/emacsclient.1 b/doc/man/emacsclient.1
index 5aaa6d1f083..24ca1c9a468 100644
--- a/doc/man/emacsclient.1
+++ b/doc/man/emacsclient.1
@@ -94,6 +94,7 @@ open a new Emacs frame on the current terminal
.TP
.B \-s, \-\-socket-name=FILENAME
use socket named FILENAME for communication.
+This can also be specified via the EMACS_SOCKET_NAME environment variable.
.TP
.B \-V, \-\-version
print version information and exit
diff --git a/etc/NEWS b/etc/NEWS
index 2249aa48ab8..be32ac6b9bb 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -120,6 +120,12 @@ the new version of the file again.)
* Changes in Emacs 27.1
+++
+** emacsclient uses EMACS_SOCKET_NAME if --socket-name is not set.
+The behavior is identical to the EMACS_SERVER_FILE, in that the
+command line value will override the environment, and the natural
+default to TMPDIR, then /tmp, continues to apply.
+
++++
** The function 'read-passwd' uses '*' as default character to hide passwords.
---
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 4fe3a588b19..42b8dd6227b 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1409,6 +1409,9 @@ set_socket (int no_exit_if_error)
#ifndef NO_SOCKETS_IN_FILE_SYSTEM
/* Explicit --socket-name argument. */
+ if (!socket_name)
+ socket_name = egetenv ("EMACS_SOCKET_NAME");
+
if (socket_name)
{
s = set_local_socket (socket_name);