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

* bug#31859: 26.1; Emacs has no way to determine if the current instance has a running server
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2018-06-16 16:15 UTC (permalink / raw)
  To: Thibault; +Cc: 31859

> From: Thibault <thibault@thb.lt>
> Date: Sat, 16 Jun 2018 18:04:19 +0200
> 
> It's all in the subject line: Emacs has no way to determine if the
> current instance has a running server.

Does it work to test whether server-process is bound and non-nil?





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

* bug#31859: 26.1; Emacs has no way to determine if the current instance has a running server
  2018-06-16 16:15 ` Eli Zaretskii
@ 2018-06-16 16:27   ` Thibault Polge
  2018-06-16 16:30     ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Thibault Polge @ 2018-06-16 16:27 UTC (permalink / raw)
  To: 31859

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

> Does it work to test whether server-process is bound and non-nil?

It works, indeed.  Would you accept a documentation PR on the variable
and the two functions, which are much more obvious candidates?
Something like:

For a general way of determining if the current instance has a server
running, check the value of `server-process`.

Or a PR adding a stupid helper function like:

;; server.el ---
...
;;;###autoload
(defun server-started-p ()
    "Return non-nil if this Emacs has a server started."
    (and (boundp server-process) server-process))

What do you think?

Th

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

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

* bug#31859: 26.1; Emacs has no way to determine if the current instance has a running server
  2018-06-16 16:27   ` Thibault Polge
@ 2018-06-16 16:30     ` Eli Zaretskii
  2018-06-23  7:52       ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2018-06-16 16:30 UTC (permalink / raw)
  To: Thibault Polge; +Cc: 31859

> From: Thibault Polge <thibault@thb.lt>
> Date: Sat, 16 Jun 2018 18:27:03 +0200
> 
> > Does it work to test whether server-process is bound and non-nil?
> 
> It works, indeed.  Would you accept a documentation PR on the variable
> and the two functions, which are much more obvious candidates?
> Something like:
> 
> For a general way of determining if the current instance has a server
> running, check the value of `server-process`.
> 
> Or a PR adding a stupid helper function like:

I'd prefer a documentation change, but let's see if someone has other
opinions.





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

* bug#31859: 26.1; Emacs has no way to determine if the current instance has a running server
  2018-06-16 16:30     ` Eli Zaretskii
@ 2018-06-23  7:52       ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2018-06-23  7:52 UTC (permalink / raw)
  To: thibault; +Cc: 31859-done

> Date: Sat, 16 Jun 2018 19:30:51 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 31859@debbugs.gnu.org
> 
> > From: Thibault Polge <thibault@thb.lt>
> > Date: Sat, 16 Jun 2018 18:27:03 +0200
> > 
> > > Does it work to test whether server-process is bound and non-nil?
> > 
> > It works, indeed.  Would you accept a documentation PR on the variable
> > and the two functions, which are much more obvious candidates?
> > Something like:
> > 
> > For a general way of determining if the current instance has a server
> > running, check the value of `server-process`.
> > 
> > Or a PR adding a stupid helper function like:
> 
> I'd prefer a documentation change, but let's see if someone has other
> opinions.

No further comments, so I installed a documentation change, and I'm
marking this bug done.

Thanks.





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