diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2007-09-19 02:00:54 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2007-09-19 02:00:54 +0000 |
commit | 44954c2f94bf24ed1eaece22da665c088109efa3 (patch) | |
tree | 560a3ad565f100a010ae4f7557d549e451432de9 /lisp/server.el | |
parent | 44fe0f65718f0ad4458b7a5a7648321888cd62d2 (diff) | |
download | emacs-44954c2f94bf24ed1eaece22da665c088109efa3.tar.gz |
(server-running-p): New function.
Diffstat (limited to 'lisp/server.el')
-rw-r--r-- | lisp/server.el | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lisp/server.el b/lisp/server.el index 5c44986bb2c..f22d693ffaa 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -391,7 +391,8 @@ message." (server-log (format "server-handle-suspend-tty, terminal %s" terminal) proc) (condition-case err (server-send-string proc "-suspend \n") - (file-error (ignore-errors (server-delete-client proc)))))) + (file-error ;The pipe/socket was closed. + (ignore-errors (server-delete-client proc)))))) (defun server-unquote-arg (arg) "Remove &-quotation from ARG. @@ -526,6 +527,21 @@ kill any existing server communications subprocess." " " (int-to-string (emacs-pid)) "\n" auth-key))))))))) +(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 server-socket-dir))) + t) + (file-error nil))) + ;;;###autoload (define-minor-mode server-mode "Toggle Server mode. |