]> git.eshelyaron.com Git - emacs.git/commitdiff
(server-running-p): New function.
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 19 Sep 2007 02:00:54 +0000 (02:00 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 19 Sep 2007 02:00:54 +0000 (02:00 +0000)
lisp/ChangeLog
lisp/server.el

index d75995a3b54db95565bc37b7feb2d82a781bd8f6..a00191735fd24bfda776043aef5f4156dd0e1891 100644 (file)
@@ -1,3 +1,7 @@
+2007-09-19  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * server.el (server-running-p): New function.
+
 2007-09-18  Jason Rumney  <jasonr@gnu.org>
 
        * term/w32-win.el (w32-focus-frame): Make obsolete alias for
index 5c44986bb2cfcc48f9c81e95f82e688cd06a462b..f22d693ffaa9589f62524bdd113e0b7f7bbc8345 100644 (file)
@@ -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.