[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100150: Prevent server-mode from
From: |
Chong Yidong |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100150: Prevent server-mode from issuing a prompt in kill-emacs-hook. |
Date: |
Sun, 31 Oct 2010 23:35:06 -0400 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 100150
committer: Chong Yidong <address@hidden>
branch nick: emacs-23
timestamp: Sun 2010-10-31 23:35:06 -0400
message:
Prevent server-mode from issuing a prompt in kill-emacs-hook.
* server.el (server-start): New arg INHIBIT-PROMPT prevents asking
user for confirmation.
(server-force-stop): Use it.
(server-start): Use server-force-stop for kill-emacs-hook, to
avoid user interaction while killing Emacs.
modified:
lisp/ChangeLog
lisp/server.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2010-11-01 03:13:42 +0000
+++ b/lisp/ChangeLog 2010-11-01 03:35:06 +0000
@@ -1,3 +1,11 @@
+2010-11-01 Chong Yidong <address@hidden>
+
+ * server.el (server-start): New arg INHIBIT-PROMPT prevents asking
+ user for confirmation.
+ (server-force-stop): Use it.
+ (server-start): Use server-force-stop for kill-emacs-hook, to
+ avoid user interaction while killing Emacs.
+
2010-10-31 Stefan Monnier <address@hidden>
* vc/log-edit.el (log-edit-rewrite-fixes): New var.
=== modified file 'lisp/server.el'
--- a/lisp/server.el 2010-09-29 13:24:55 +0000
+++ b/lisp/server.el 2010-11-01 03:35:06 +0000
@@ -485,7 +485,7 @@
(error "The directory `%s' is unsafe" dir)))))
;;;###autoload
-(defun server-start (&optional leave-dead)
+(defun server-start (&optional leave-dead inhibit-prompt)
"Allow this Emacs process to be a server for client processes.
This starts a server communications subprocess through which
client \"editors\" can send your editing commands to this Emacs
@@ -495,7 +495,10 @@
Optional argument LEAVE-DEAD (interactively, a prefix arg) means just
kill any existing server communications subprocess.
-If a server is already running, the server is not started.
+If a server is already running, restart it. If clients are
+running, ask the user for confirmation first, unless optional
+argument INHIBIT-PROMPT is non-nil.
+
To force-start a server, do \\[server-force-delete] and then
\\[server-start]."
(interactive "P")
@@ -503,12 +506,14 @@
;; Ask the user before deleting existing clients---except
;; when we can't get user input, which may happen when
;; doing emacsclient --eval "(kill-emacs)" in daemon mode.
- (if (and (daemonp)
- (null (cdr (frame-list)))
- (eq (selected-frame) terminal-frame))
- leave-dead
- (yes-or-no-p
- "The current server still has clients; delete them? ")))
+ (cond
+ ((and (daemonp)
+ (null (cdr (frame-list)))
+ (eq (selected-frame) terminal-frame))
+ leave-dead)
+ (inhibit-prompt t)
+ (t (yes-or-no-p
+ "The current server still has clients; delete them? "))))
(let* ((server-dir (if server-use-tcp server-auth-dir server-socket-dir))
(server-file (expand-file-name server-name server-dir)))
(when server-process
@@ -545,7 +550,7 @@
(add-hook 'delete-frame-functions 'server-handle-delete-frame)
(add-hook 'kill-buffer-query-functions
'server-kill-buffer-query-function)
(add-hook 'kill-emacs-query-functions
'server-kill-emacs-query-function)
- (add-hook 'kill-emacs-hook (lambda () (server-mode -1))) ;Cleanup
upon exit.
+ (add-hook 'kill-emacs-hook 'server-force-stop) ;Cleanup upon exit.
(setq server-process
(apply #'make-network-process
:name server-name
@@ -586,6 +591,11 @@
" " (int-to-string (emacs-pid))
"\n" auth-key)))))))))
+(defun server-force-stop ()
+ "Kill all connections to the current server.
+This function is meant to be called from `kill-emacs-hook'."
+ (server-start nil t))
+
;;;###autoload
(defun server-force-delete (&optional name)
"Unconditionally delete connection file for server NAME.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/emacs-23 r100150: Prevent server-mode from issuing a prompt in kill-emacs-hook.,
Chong Yidong <=