changeset 83251:de637975e99a

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
author Karoly Lorentey <lorentey@elte.hu>
date Thu, 10 Feb 2005 21:23:33 +0000
parents 89ac10c67e45
children 6e0f153725ab
files lisp/server.el
diffstat 1 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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))))