Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save avar/402347 to your computer and use it in GitHub Desktop.

Select an option

Save avar/402347 to your computer and use it in GitHub Desktop.
From 3156918640c7fbb2584405f9bf1a2249626eaba4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= <avarab@gmail.com>
Date: Sat, 15 May 2010 18:24:49 +0000
Subject: [PATCH] Use $EMACS_SERVER_SOCKET_DIR for server-socket-dir if it's defined
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This allows for overriding the directory where emacsclient looks for
the server socket without overriding TMPDIR indiscriminately.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
lib-src/emacsclient.c | 4 +++-
lisp/server.el | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 1e7ec7d..f8f4983 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1246,7 +1246,9 @@ set_local_socket ()
if (default_sock)
{
- tmpdir = egetenv ("TMPDIR");
+ tmpdir = egetenv ("EMACS_SERVER_SOCKET_DIR");
+ if (!tmpdir)
+ tmpdir = egetenv ("TMPDIR");
if (!tmpdir)
tmpdir = "/tmp";
socket_name = alloca (strlen (tmpdir) + strlen (server_name)
diff --git a/lisp/server.el b/lisp/server.el
index 6b5f248..778559c 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -218,7 +218,7 @@ changed while a server is running."
;; does not read the init file.
(defvar server-socket-dir
(and (featurep 'make-network-process '(:family local))
- (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid)))
+ (format "%s/emacs%d" (or (getenv "EMACS_SERVER_SOCKET_DIR") (getenv "TMPDIR") "/tmp") (user-uid)))
"The directory in which to place the server socket.
If local sockets are not supported, this is nil.")
--
1.7.1.84.gd92f8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment