all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* server-running-p: not detect server running by other emacs instance
@ 2008-04-05 12:29 Liang Wang
  2008-04-05 17:55 ` Stefan Monnier
       [not found] ` <mailman.10048.1207418159.18990.bug-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Liang Wang @ 2008-04-05 12:29 UTC (permalink / raw)
  To: bug-gnu-emacs

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?


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

end of thread, other threads:[~2008-04-06  2:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-05 12:29 server-running-p: not detect server running by other emacs instance Liang Wang
2008-04-05 17:55 ` Stefan Monnier
     [not found] ` <mailman.10048.1207418159.18990.bug-gnu-emacs@gnu.org>
2008-04-06  2:58   ` Liang Wang

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.