unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#13319: 24.2.91; emacsclient doesn't find server with nonstandard name
@ 2012-12-31 17:11 Michael Heerdegen
  2012-12-31 19:34 ` Andreas Schwab
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2012-12-31 17:11 UTC (permalink / raw)
  To: 13319

Hi,

In emacs -Q, do this:

(progn
  (require 'server)
  (let ((server-name (concat "server_" (format-time-string  "%H:%M:%S"))))
    (server-start)))

Then I try to connect to this server, but it fails:

| bash-4.2:mh:~$ /usr/bin/emacsclient ~/.bashrc 
| /usr/bin/emacsclient: can't find socket; have you started the server?
| To start the server in Emacs, type "M-x server-start".
| /usr/bin/emacsclient: No socket or alternate editor.  Please use:
| 
|         --socket-name
|         --server-file      (or environment variable EMACS_SERVER_FILE)
|         --alternate-editor (or environment variable ALTERNATE_EDITOR)


When I explicitly specify the server name with the -s option,
emacsclient succeeds.  But due to the doc (man page), "emacsclient"
should connect to "the first server it finds":

| `-s SERVER-NAME'
| `--socket-name=SERVER-NAME'
|      Connect to the Emacs server named SERVER-NAME.  The server name is
|      given by the variable `server-name' on the Emacs server.  If this
|      option is omitted, `emacsclient' connects to the first server it
|      finds.  (This option is not supported on MS-Windows.)

Obviously this is not fulfilled here.  And it is no useful behavior.  If
only one server is running (and the socket is located under the
canonical path), emacsclient should find and use it.  It is arguable
which server should be used if more than one is running (and what the
"first server it finds" should be).

BTW, here is an explanation for why I want to start the server like
above (not substantially important for this report):

I often make changes to my config file/ elpa installations or rebuild
Emacs.  To guarantee that I always have a running Emacs (as a fallback
when something went wrong and a newly started Emacs fails to start), I
keep my old Emacs open and start a new one.  If I had just

  (server-start)

in my config, the new Emacs would not start a server (since the old one
is still running).  After having closed the old Emacs, I had no server
running, so I had to manually start the server every time.  This is
annoying.  So I want to start a server with a unique name.


Thanks,

Michael.


In GNU Emacs 24.2.91.2 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10)
 of 2012-12-30 on drachen
Bzr revision: rgm@gnu.org-20121230122326-m6gw29pkwjgwqf9d
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
System Description:	Debian GNU/Linux testing (wheezy)






^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-07-16 12:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-31 17:11 bug#13319: 24.2.91; emacsclient doesn't find server with nonstandard name Michael Heerdegen
2012-12-31 19:34 ` Andreas Schwab
2012-12-31 20:20   ` Michael Heerdegen
2021-07-15 15:56     ` Lars Ingebrigtsen
2021-07-16  1:08       ` Michael Heerdegen
2021-07-16  8:49         ` Lars Ingebrigtsen
2021-07-16 11:24           ` Eli Zaretskii
2021-07-16 12:51             ` Lars Ingebrigtsen

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).