aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Pittman2018-09-05 09:44:58 -0400
committerEli Zaretskii2018-10-27 12:18:27 +0300
commit3e81e9a0e7742197354515f3d3ea55fdb201eb29 (patch)
tree7ea45bc194843b5c6c5564a3be96fa67306e90b7
parent8fffac14b19d375f774b835ea33ef8989300125d (diff)
downloademacs-3e81e9a0e7742197354515f3d3ea55fdb201eb29.tar.gz
emacs-3e81e9a0e7742197354515f3d3ea55fdb201eb29.zip
Add support in emacsclient for EMACS_SOCKET_NAME
If the '--socket-name' argument is unspecified, the environment variable 'EMACS_SOCKET_NAME' is now consulted with the same semantics. This mirrors the behavior of the '--server-file' argument, and allows for easier configuration of emacsclient when the socket is in a location other than 'TMPDIR' or '/tmp'. * emacsclient.c (set_socket): Add support for the EMACS_SOCKET_NAME environment variable. (Bug#33095) * misc.texi (emacsclient Options): * emacsclient.1: Document the EMACS_SOCKET_NAME environment variable. * etc/NEWS: Announce the new feature. Copyright-paperwork-exempt: yes
-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
1966this option is omitted, @command{emacsclient} connects to the first 1966this option is omitted, @command{emacsclient} connects to the first
1967server it finds. (This option is not supported on MS-Windows.) 1967server it finds. (This option is not supported on MS-Windows.)
1968 1968
1969Alternatively, you can set the @env{EMACS_SOCKET_NAME} environment
1970variable to point to the server socket. (The command-line option
1971overrides the environment variable.)
1972
1969@item -t 1973@item -t
1970@itemx --tty 1974@itemx --tty
1971@itemx -nw 1975@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
94.TP 94.TP
95.B \-s, \-\-socket-name=FILENAME 95.B \-s, \-\-socket-name=FILENAME
96use socket named FILENAME for communication. 96use socket named FILENAME for communication.
97This can also be specified via the EMACS_SOCKET_NAME environment variable.
97.TP 98.TP
98.B \-V, \-\-version 99.B \-V, \-\-version
99print version information and exit 100print 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.)
120* Changes in Emacs 27.1 120* Changes in Emacs 27.1
121 121
122+++ 122+++
123** emacsclient uses EMACS_SOCKET_NAME if --socket-name is not set.
124The behavior is identical to the EMACS_SERVER_FILE, in that the
125command line value will override the environment, and the natural
126default to TMPDIR, then /tmp, continues to apply.
127
128+++
123** The function 'read-passwd' uses '*' as default character to hide passwords. 129** The function 'read-passwd' uses '*' as default character to hide passwords.
124 130
125--- 131---
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)
1409 1409
1410#ifndef NO_SOCKETS_IN_FILE_SYSTEM 1410#ifndef NO_SOCKETS_IN_FILE_SYSTEM
1411 /* Explicit --socket-name argument. */ 1411 /* Explicit --socket-name argument. */
1412 if (!socket_name)
1413 socket_name = egetenv ("EMACS_SOCKET_NAME");
1414
1412 if (socket_name) 1415 if (socket_name)
1413 { 1416 {
1414 s = set_local_socket (socket_name); 1417 s = set_local_socket (socket_name);