Mercurial > emacs
changeset 101125:30796b5e3f42
(server-save-buffers-kill-terminal): Args changed. Handle nowait
client frames.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sun, 11 Jan 2009 16:45:36 +0000 |
parents | e5e83a193032 |
children | 7c467055463f |
files | lisp/server.el |
diffstat | 1 files changed, 21 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/server.el Sun Jan 11 16:43:48 2009 +0000 +++ b/lisp/server.el Sun Jan 11 16:45:36 2009 +0000 @@ -1341,24 +1341,32 @@ (select-frame-set-input-focus (window-frame (selected-window)))))) ;;;###autoload -(defun server-save-buffers-kill-terminal (proc &optional arg) +(defun server-save-buffers-kill-terminal (arg) ;; Called from save-buffers-kill-terminal in files.el. - "Offer to save each buffer, then kill PROC. - + "Offer to save each buffer, then kill the current client. With ARG non-nil, silently save all file-visiting buffers, then kill. If emacsclient was started with a list of filenames to edit, then only these files will be asked to be saved." - (when (processp proc) - (let ((buffers (process-get proc 'buffers))) - ;; If client is bufferless, emulate a normal Emacs session - ;; exit and offer to save all buffers. Otherwise, offer to - ;; save only the buffers belonging to the client. - (save-some-buffers arg - (if buffers - (lambda () (memq (current-buffer) buffers)) - t)) - (server-delete-client proc)))) + (let ((proc (frame-parameter (selected-frame) 'client))) + (cond ((eq proc 'nowait) + ;; Nowait frames have no client buffer list. + (if (cdr (frame-list)) + (progn (save-some-buffers arg) + (delete-frame)) + ;; If we're the last frame standing, kill Emacs. + (save-buffers-kill-emacs arg))) + ((processp proc) + (let ((buffers (process-get proc 'buffers))) + ;; If client is bufferless, emulate a normal Emacs exit + ;; and offer to save all buffers. Otherwise, offer to + ;; save only the buffers belonging to the client. + (save-some-buffers + arg (if buffers + (lambda () (memq (current-buffer) buffers)) + t)) + (server-delete-client proc))) + (t (error "Invalid client frame"))))) (define-key ctl-x-map "#" 'server-edit)