* bug#33095: [PATCH] Add support in emacsclient for EMACS_SOCKET_NAME
@ 2018-10-19 13:45 Daniel Pittman
2018-10-27 9:27 ` Eli Zaretskii
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Pittman @ 2018-10-19 13:45 UTC (permalink / raw)
To: 33095
[-- Attachment #1.1: Type: text/plain, Size: 663 bytes --]
This patch implements EMACS_SOCKET_NAME in emacsclient, providing the
same sort of "set the argument from the environment" feature for the
socket name as for other features.
I use this to enable a stable, consistent path on a set of machines
where I use Unix domain socket forwarding and TRAMP to enable easy
emacsclient use from within tmux -- where I can't easily know the UID
I'll be logged in as programatically.
While this certainly could be a "you have a configuration problem", the
symmetry with other settings including the TRAMP prefix makes me feel
this is a useful addition -- or at least, not out of line with how
similar options can be configured.
[-- Attachment #1.2: Type: text/html, Size: 903 bytes --]
[-- Attachment #2: 0001-Add-support-in-emacsclient-for-EMACS_SOCKET_NAME.patch --]
[-- Type: application/octet-stream, Size: 2887 bytes --]
From 429dc5bafa7824d603a9fc2a0787992d226e7f93 Mon Sep 17 00:00:00 2001
From: Daniel Pittman <slippycheeze@google.com>
Date: Wed, 5 Sep 2018 09:44:58 -0400
Subject: [PATCH] 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.
* misc.texi (emacsclient Options):
* emacsclient.1:
Document the EMACS_SOCKET_NAME environment variable.
---
doc/emacs/misc.texi | 4 ++++
doc/man/emacsclient.1 | 1 +
etc/NEWS | 6 ++++++
lib-src/emacsclient.c | 3 +++
4 files changed, 14 insertions(+)
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 236cb07785..ab33cafb8e 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 5aaa6d1f08..24ca1c9a46 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 f1be50babd..68781f8c55 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -122,6 +122,12 @@ the new version of the file again.)
\f
* 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 4fe3a588b1..42b8dd6227 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);
--
2.19.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#33095: [PATCH] Add support in emacsclient for EMACS_SOCKET_NAME
2018-10-19 13:45 bug#33095: [PATCH] Add support in emacsclient for EMACS_SOCKET_NAME Daniel Pittman
@ 2018-10-27 9:27 ` Eli Zaretskii
0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2018-10-27 9:27 UTC (permalink / raw)
To: Daniel Pittman; +Cc: 33095-done
> From: Daniel Pittman <slippycheeze@google.com>
> Date: Fri, 19 Oct 2018 09:45:57 -0400
>
> This patch implements EMACS_SOCKET_NAME in emacsclient, providing the
> same sort of "set the argument from the environment" feature for the
> socket name as for other features.
Thanks, pushed to the master branch.
A few minor nits for the future:
> If the `--socket-name` argument is unspecified, the environment
> variable `EMACS_SOCKET_NAME` is now consulted with the same
We don't use the markdown-style quoting `like this`, we use quoting
'like this' instead.
> semantics. This mirrors the behavior of the `--server-file` argument,
Please leave 2 spaces between sentences in documentation and comments.
Finally, it looks like your copyright assignment is only for rcp.el
and for Gnus, so I think we will need a general Emacs assignment to
accept your future contributions. Please write to
copyright-clerk@fsf.org and ask him whether this is indeed so, as I
could be mistaken.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-27 9:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-19 13:45 bug#33095: [PATCH] Add support in emacsclient for EMACS_SOCKET_NAME Daniel Pittman
2018-10-27 9:27 ` Eli Zaretskii
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).