Commit d6b4b3cf authored by Karoly Lorentey's avatar Karoly Lorentey
Browse files

Make server-start safe against accidental restarts.

* lisp/server.el (server-start): Ask before restarting if the old server
  still has clients.  Added feedback messages.


git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-195
parent 8516815b
......@@ -368,6 +368,10 @@ Emacs distribution as your standard \"editor\".
Prefix arg means just kill any existing server communications subprocess."
(interactive "P")
(when (or
(not server-clients)
(yes-or-no-p
"The current server still has clients; delete them? "))
;; It is safe to get the user id now.
(setq server-socket-dir (or server-socket-dir
(format "/tmp/emacs%d" (user-uid))))
......@@ -383,9 +387,13 @@ Prefix arg means just kill any existing server communications subprocess."
;; If this Emacs already had a server, clear out associated status.
(while server-clients
(server-delete-client (car server-clients)))
(unless leave-dead
(if leave-dead
(progn
(server-log (message "Server stopped"))
(setq server-process nil))
(if server-process
(server-log (message "Restarting server")))
(server-log (message "Restarting server"))
(server-log (message "Starting server")))
(letf (((default-file-modes) ?\700))
(add-hook 'delete-tty-after-functions 'server-handle-delete-tty)
(add-hook 'suspend-tty-functions 'server-handle-suspend-tty)
......@@ -400,7 +408,7 @@ Prefix arg means just kill any existing server communications subprocess."
;; We must receive file names without being decoded.
;; Those are decoded by server-process-filter according
;; to file-name-coding-system.
:coding 'raw-text)))))
:coding 'raw-text))))))
;;;###autoload
(define-minor-mode server-mode
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment