From 35f372cadfaf129d62e81951d4516c687b67d189 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Tue, 16 Dec 2008 21:23:03 +0000 Subject: [PATCH] * server.el (server-start): If unable to start the server, display a warning instead of raising an error. * startup.el (server-process): Add defvar. (command-line): If the daemon is unable to start the server, display a message and exit Emacs. --- lisp/ChangeLog | 9 +++++++++ lisp/server.el | 7 +++++-- lisp/startup.el | 6 +++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5d96307e73f..38514d0b0a3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2008-12-16 Juanma Barranquero + + * server.el (server-start): If unable to start the server, + display a warning instead of raising an error. + + * startup.el (server-process): Add defvar. + (command-line): If the daemon is unable to start the server, + display a message and exit Emacs. + 2008-12-15 Sam Steingold * progmodes/cc-cmds.el (c-defun-name): Handle DEFFOO(name,...), diff --git a/lisp/server.el b/lisp/server.el index 627805da66c..f8c405b1305 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -479,14 +479,17 @@ To force-start a server, do \\[server-force-delete] and then ;; Remove any leftover socket or authentication file (ignore-errors (delete-file server-file)) (setq server-mode nil) ;; already set by the minor mode code - (error "Server %S is already running" server-name)) + (display-warning 'server + (format "Emacs server named %S already running" server-name) + :warning) + (setq leave-dead t)) ;; If this Emacs already had a server, clear out associated status. (while server-clients (server-delete-client (car server-clients))) ;; Now any previous server is properly stopped. (if leave-dead (progn - (server-log (message "Server stopped")) + (unless (eq t leave-dead) (server-log (message "Server stopped"))) (setq server-process nil)) ;; Make sure there is a safe directory in which to place the socket. (server-ensure-safe-dir server-dir) diff --git a/lisp/startup.el b/lisp/startup.el index f328a914584..2fa1a6c15cd 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -694,6 +694,7 @@ opening the first frame (e.g. open a connection to an X server).") (declare-function tool-bar-setup "tool-bar") (defvar server-name) +(defvar server-process) (defun command-line () (setq before-init-time (current-time) @@ -1220,7 +1221,10 @@ the `--debug-init' option to view a complete error backtrace." (when dn (when (stringp dn) (setq server-name dn)) (server-start) - (daemon-initialized))) + (if server-process + (daemon-initialized) + (message "Unable to start daemon: Emacs server named %S already running" server-name) + (kill-emacs 1)))) ;; Run emacs-session-restore (session management) if started by ;; the session manager and we have a session manager connection. -- 2.39.2