# HG changeset patch # User Karoly Lorentey # Date 1108070613 0 # Node ID de637975e99a3025e1f1a738ee869e7f1f82c4e1 # Parent 89ac10c67e45331d91c76c1a3c0aecb9f343e372 On C-x C-c, restrict `save-some-buffers' to the client's buffers. (Reported by Han Boetes.) * lisp/server.el (server-kill-emacs-query-function): Fix typo in docs. (server-save-buffers-kill-display): If emacsclient was started with a list of filenames to edit, then offer to save only these buffers. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-291 diff -r 89ac10c67e45 -r de637975e99a lisp/server.el --- a/lisp/server.el Thu Feb 10 20:43:55 2005 +0000 +++ b/lisp/server.el Thu Feb 10 21:23:33 2005 +0000 @@ -922,7 +922,7 @@ (buffer-name (current-buffer)))))) (defun server-kill-emacs-query-function () - "Ask before exiting Emacs it has are live clients." + "Ask before exiting Emacs it has live clients." (or (not server-clients) (let (live-client) (dolist (client server-clients live-client) @@ -1031,12 +1031,21 @@ "Offer to save each buffer, then kill the current connection. If the current frame has no client, kill Emacs itself. -With prefix arg, silently save all file-visiting buffers, then kill." +With prefix arg, 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." (interactive "P") (let ((proc (frame-parameter (selected-frame) 'client))) - (if (and proc) - (progn - (save-some-buffers arg t) + (if proc + (let ((buffers (server-client-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)) (save-buffers-kill-emacs))))