unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Liang Wang <netcasper@gmail.com>
To: bug-gnu-emacs@gnu.org
Subject: server-running-p: not detect server running by other emacs instance
Date: Sat, 5 Apr 2008 05:29:52 -0700 (PDT)	[thread overview]
Message-ID: <38db448b-c6e9-45b5-a76e-73cee4ea053d@z24g2000prf.googlegroups.com> (raw)

I modify server-running-p in server.el to make it to detect server
running by other emacs instance.  With this modification, server
started by first emacs instance won't be killed by successive
instances.

(unless (server-running-p)
  (server-start))

I replace server-socket-dir with (or server-socket-dir (format "/tmp/
emacs%d" (user-uid))) since server-socket-dir only set by server-
start.  Here is whole function.

(defun server-running-p  (&optional name)
  "Test whether server NAME is running."
  (interactive
   (list (if current-prefix-arg
	     (read-string "Server name: " nil nil server-name))))
  (unless name (setq name server-name))
  (condition-case nil
      (progn
	(delete-process
	 (make-network-process
	  :name "server-client-test" :family 'local :server nil :noquery t
	  :service (expand-file-name name (or server-socket-dir
					      (format "/tmp/emacs%d" (user-uid))))))
	t)
    (file-error nil)))

Does this make sense to be a patch to emacs?


             reply	other threads:[~2008-04-05 12:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-05 12:29 Liang Wang [this message]
2008-04-05 17:55 ` server-running-p: not detect server running by other emacs instance Stefan Monnier
     [not found] ` <mailman.10048.1207418159.18990.bug-gnu-emacs@gnu.org>
2008-04-06  2:58   ` Liang Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=38db448b-c6e9-45b5-a76e-73cee4ea053d@z24g2000prf.googlegroups.com \
    --to=netcasper@gmail.com \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).