unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#31859: 26.1; Emacs has no way to determine if the current instance has a running server
@ 2018-06-16 16:04 Thibault
  2018-06-16 16:15 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Thibault @ 2018-06-16 16:04 UTC (permalink / raw)
  To: 31859

[-- Attachment #1: Type: text/plain, Size: 1066 bytes --]

It's all in the subject line: Emacs has no way to determine if the
current instance has a running server.  There's the `server-mode'
variable along with the `daemonp' and `server-running-p' functions, but
none of them are actually usable for the most elementary use case of
determining whether *this* instance has a server started.

 - `server-mode' is nil if the server was started with `M-x server-start',
   and t only if was started with `server-mode'

 - `(daemonp)' returns non-nil if and only if emacs was started as a
   daemon.

That is, the following sexp:

(progn
    (require 'server)
    (server-start)
    (or server-mode (daemonp)))

will always evaluate to nil, except from emacsclient.

 - (server-running-p) tries to determine if /some/ server is running,
   somewhere, that is configured like the current server would be, but
   it doesn't guarantee that the server runs from the current instance.
   If you start two instances, `(server-running-p)' will eval to `t' *in
   both* after the server was started in any one of them.

Thanks,
Thibault

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

end of thread, other threads:[~2018-06-23  7:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-16 16:04 bug#31859: 26.1; Emacs has no way to determine if the current instance has a running server Thibault
2018-06-16 16:15 ` Eli Zaretskii
2018-06-16 16:27   ` Thibault Polge
2018-06-16 16:30     ` Eli Zaretskii
2018-06-23  7:52       ` 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).