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

* bug#13319: 24.2.91; emacsclient doesn't find server with nonstandard name
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2012-12-31 19:34 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 13319

Michael Heerdegen <michael_heerdegen@web.de> writes:

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

This is questionable.  How does it know that a random socket is a emacs
server socket?

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





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

* bug#13319: 24.2.91; emacsclient doesn't find server with nonstandard name
  2012-12-31 19:34 ` Andreas Schwab
@ 2012-12-31 20:20   ` Michael Heerdegen
  2021-07-15 15:56     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2012-12-31 20:20 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 13319

Andreas Schwab <schwab@linux-m68k.org> writes:

> Michael Heerdegen <michael_heerdegen@web.de> writes:
>
> > 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.
>
> This is questionable.  How does it know that a random socket is a emacs
> server socket?

Here on Debian, it looks under /tmp/emacs$UID.  Can there be any other
socket?


Regards,

Michael.





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

* bug#13319: 24.2.91; emacsclient doesn't find server with nonstandard name
  2012-12-31 20:20   ` Michael Heerdegen
@ 2021-07-15 15:56     ` Lars Ingebrigtsen
  2021-07-16  1:08       ` Michael Heerdegen
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-15 15:56 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Andreas Schwab, 13319

Michael Heerdegen <michael_heerdegen@web.de> writes:

>> > 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.
>>
>> This is questionable.  How does it know that a random socket is a emacs
>> server socket?
>
> Here on Debian, it looks under /tmp/emacs$UID.  Can there be any other
> socket?

This was eight years ago, and some things have changed in this area
(like the location of the server socket), but the issue still remains, I
think?  That is, the client won't look around for a socket with a
non-standard name.

But I tend to think that this is actually the correct behaviour --
having emacsclient guess at what socket name to use sounds a bit too
DWIM to me:  I may deliberately have set up a server to do one very
specific thing under a non-standard name, and I would not want any
random emacsclient invocation to use that special server just because it
can't find the standard socket.  (Which I may just have forgotten to
start the server for.)

So I think this behaves as it should.  Anybody else got another opinion?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#13319: 24.2.91; emacsclient doesn't find server with nonstandard name
  2021-07-15 15:56     ` Lars Ingebrigtsen
@ 2021-07-16  1:08       ` Michael Heerdegen
  2021-07-16  8:49         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2021-07-16  1:08 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Andreas Schwab, 13319

Lars Ingebrigtsen <larsi@gnus.org> writes:

> >> This is questionable.  How does it know that a random socket is a emacs
> >> server socket?
> >
> > Here on Debian, it looks under /tmp/emacs$UID.  Can there be any other
> > socket?
>
> This was eight years ago, and some things have changed in this area
> (like the location of the server socket), but the issue still remains, I
> think?

Seems so.

> That is, the client won't look around for a socket with a
> non-standard name.
>
> But I tend to think that this is actually the correct behaviour --
> having emacsclient guess at what socket name to use sounds a bit too
> DWIM to me:  I may deliberately have set up a server to do one very
> specific thing under a non-standard name, and I would not want any
> random emacsclient invocation to use that special server just because it
> can't find the standard socket.  (Which I may just have forgotten to
> start the server for.)

What would happen in this case?  Can't you use another place to store
the socket then?

> So I think this behaves as it should.  Anybody else got another opinion?

I don't know if something like you describe could be prevented.  If you
are sure that my suggestion would cause trouble, then I'm ok with
closing.  I'm too ignorant about how this socket stuff is working to
have an opinion.

Michael.





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

* bug#13319: 24.2.91; emacsclient doesn't find server with nonstandard name
  2021-07-16  1:08       ` Michael Heerdegen
@ 2021-07-16  8:49         ` Lars Ingebrigtsen
  2021-07-16 11:24           ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-16  8:49 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Andreas Schwab, 13319

Michael Heerdegen <michael_heerdegen@web.de> writes:

> What would happen in this case?  Can't you use another place to store
> the socket then?

I can, but I don't see how that's a better design.

>> So I think this behaves as it should.  Anybody else got another opinion?
>
> I don't know if something like you describe could be prevented.  If you
> are sure that my suggestion would cause trouble, then I'm ok with
> closing.

I think it would, but I'd like to hear whether anybody else has an
opinion here...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#13319: 24.2.91; emacsclient doesn't find server with nonstandard name
  2021-07-16  8:49         ` Lars Ingebrigtsen
@ 2021-07-16 11:24           ` Eli Zaretskii
  2021-07-16 12:51             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2021-07-16 11:24 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: michael_heerdegen, schwab, 13319

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Fri, 16 Jul 2021 10:49:24 +0200
> Cc: Andreas Schwab <schwab@linux-m68k.org>, 13319@debbugs.gnu.org
> 
> >> So I think this behaves as it should.  Anybody else got another opinion?
> >
> > I don't know if something like you describe could be prevented.  If you
> > are sure that my suggestion would cause trouble, then I'm ok with
> > closing.
> 
> I think it would, but I'd like to hear whether anybody else has an
> opinion here...

I think we should fix the documentation to not say anything about "the
first available socket" there.  If the socket name is not the default
one, the user should tell emacsclient which socket to use.





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

* bug#13319: 24.2.91; emacsclient doesn't find server with nonstandard name
  2021-07-16 11:24           ` Eli Zaretskii
@ 2021-07-16 12:51             ` Lars Ingebrigtsen
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-16 12:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: michael_heerdegen, schwab, 13319

Eli Zaretskii <eliz@gnu.org> writes:

> I think we should fix the documentation to not say anything about "the
> first available socket" there.  If the socket name is not the default
> one, the user should tell emacsclient which socket to use.

Yup.  Done, and closing.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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