Commit 7540c1e0 authored by Karoly Lorentey's avatar Karoly Lorentey
Browse files

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
parent bdfec213
...@@ -922,7 +922,7 @@ specifically for the clients and did not exist before their request for it." ...@@ -922,7 +922,7 @@ specifically for the clients and did not exist before their request for it."
(buffer-name (current-buffer)))))) (buffer-name (current-buffer))))))
(defun server-kill-emacs-query-function () (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) (or (not server-clients)
(let (live-client) (let (live-client)
(dolist (client server-clients live-client) (dolist (client server-clients live-client)
...@@ -1031,12 +1031,21 @@ done that." ...@@ -1031,12 +1031,21 @@ done that."
"Offer to save each buffer, then kill the current connection. "Offer to save each buffer, then kill the current connection.
If the current frame has no client, kill Emacs itself. 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") (interactive "P")
(let ((proc (frame-parameter (selected-frame) 'client))) (let ((proc (frame-parameter (selected-frame) 'client)))
(if (and proc) (if proc
(progn (let ((buffers (server-client-get proc 'buffers)))
(save-some-buffers arg t) ;; 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)) (server-delete-client proc))
(save-buffers-kill-emacs)))) (save-buffers-kill-emacs))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment