Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

server-running-p: not detect server running by other emacs instance

6 views
Skip to first unread message

Liang Wang

unread,
Apr 5, 2008, 8:29:52 AM4/5/08
to
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?

Stefan Monnier

unread,
Apr 5, 2008, 1:55:54 PM4/5/08
to Liang Wang, bug-gn...@gnu.org
> 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.

If I understand correctly, you're reporting a bug that server-running-p
doesn't work if you haven't called server-start before. I believe I've
just fixed it in the trunk,


Stefan


Liang Wang

unread,
Apr 5, 2008, 10:58:51 PM4/5/08
to

Thanks. I didn't check latest version carefully.

0 new messages