From 6bc1562dfc674df50f4947653be6e1a4cd436ccf Mon Sep 17 00:00:00 2001 From: Matthew Leach Date: Thu, 25 Jan 2018 19:24:14 +0000 Subject: [PATCH 4/4] Rename internal--external-sockname and document (Bug#24218) * lisp/server.el: Rename `internal--external-sockname' to `internal-daemon-sockname'. * src/process.c: Likewise. * doc/lispref/processes.texi: Document `internal-daemon-sockname'. --- doc/lispref/processes.texi | 17 ++++++++++++++--- lisp/server.el | 10 +++++----- src/process.c | 6 +++--- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 8a8425cb84..7f078e950f 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -2860,9 +2860,9 @@ Network Feature Testing @node Misc Network @section Misc Network Facilities - These additional functions are useful for creating and operating -on network connections. Note that they are supported only on some -systems. + These additional functions and variables are useful for creating and +operating on network connections. Note that they are supported only +on some systems. @defun network-interface-list This function returns a list describing the network interfaces @@ -2911,6 +2911,17 @@ Misc Network @code{:@var{p}} suffix. @end defun +@defvar internal--daemon-sockname +This variable is set to the full path of the socket that has been +passed to Emacs during socket activation. This is then used to update +the @code{server-name} and @code{server-socket-dir} variables to +reflect the name and path of the socket that was used to launch the +Emacs daemon process. + +If Emacs wasn't started with socket activation, the value of this +variable is @code{nil}. +@end defvar + @node Serial Ports @section Communicating with Serial Ports @cindex @file{/dev/tty} diff --git a/lisp/server.el b/lisp/server.el index 16b3f8e4e2..4e0afa26f9 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -258,8 +258,8 @@ server--external-socket-initialized been consumed.") (defcustom server-name - (if internal--external-sockname - (file-name-nondirectory internal--external-sockname) + (if internal-daemon-sockname + (file-name-nondirectory internal-daemon-sockname) "server") "The name of the Emacs server, if this Emacs process creates one. The command `server-start' makes use of this. It should not be @@ -271,8 +271,8 @@ server-name ;; We do not use `temporary-file-directory' here, because emacsclient ;; does not read the init file. (defvar server-socket-dir - (if internal--external-sockname - (file-name-directory internal--external-sockname) + (if internal-daemon-sockname + (file-name-directory internal-daemon-sockname) (and (featurep 'make-network-process '(:family local)) (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid)))) "The directory in which to place the server socket. @@ -631,7 +631,7 @@ server-start ;; Check to see if an uninitialized external socket has been ;; passed in, if that is the case, skip checking ;; `server-running-p' as this will return the wrong result. - (if (and internal--external-sockname + (if (and internal-daemon-sockname (not server--external-socket-initialized)) (setq server--external-socket-initialized t) ;; Delete the socket files made by previous server invocations. diff --git a/src/process.c b/src/process.c index 2613dd2be0..48854e24b4 100644 --- a/src/process.c +++ b/src/process.c @@ -8025,7 +8025,7 @@ init_process_emacs (int sockfd) sockname = conv_sockaddr_to_lisp (&sa.sa, salen); } # endif - Vinternal__external_sockname = sockname; + Vinternal_daemon_sockname = sockname; max_desc = -1; memset (fd_callback_info, 0, sizeof (fd_callback_info)); @@ -8219,9 +8219,9 @@ These functions are called in the order of the list, until one of them returns non-`nil'. */); Vinterrupt_process_functions = list1 (Qinternal_default_interrupt_process); - DEFVAR_LISP ("internal--external-sockname", Vinternal__external_sockname, + DEFVAR_LISP ("internal-daemon-sockname", Vinternal_daemon_sockname, doc: /* Name of external socket passed to Emacs, or nil if none. */); - Vinternal__external_sockname = Qnil; + Vinternal_daemon_sockname = Qnil; DEFSYM (Qinternal_default_interrupt_process, "internal-default-interrupt-process"); -- 2.16.1