From 7540c1e0ea7ac7767c96a69df330abd108a7247a Mon Sep 17 00:00:00 2001 From: Karoly Lorentey Date: Thu, 10 Feb 2005 21:23:33 +0000 Subject: [PATCH] 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 --- lisp/server.el | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lisp/server.el b/lisp/server.el index ec4bb3534b..d8bd83b839 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -922,7 +922,7 @@ specifically for the clients and did not exist before their request for it." (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 @@ done that." "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)))) -- 2.20.1