From: "João Távora" <joaotavora@gmail.com>
To: Noam Postavsky <npostavs@gmail.com>
Cc: 31951@debbugs.gnu.org
Subject: bug#31951: 27.0.50; [PATCH] server-save-buffers-kill-terminal should respect save-some-buffers-default-predicate
Date: Mon, 25 Jun 2018 12:07:26 +0100 [thread overview]
Message-ID: <8736xbm8ep.fsf@gmail.com> (raw)
In-Reply-To: <87r2kvq5f9.fsf@gmail.com> (Noam Postavsky's message of "Sun, 24 Jun 2018 16:46:02 -0400")
Noam Postavsky <npostavs@gmail.com> writes:
> João Távora <joaotavora@gmail.com> writes:
>
>>> (defun save-buffers-kill-emacs (&optional arg)
>>> [...]
>>> ;; Don't use save-some-buffers-default-predicate, because we want
>>> ;; to ask about all the buffers before killing Emacs.
>>> (save-some-buffers arg t)
>>
>> Right, but thats because, when killing Emacs, it is really the last
>> chance to save those buffers before they're potentially gone for good.
>
> Oh, I got mixed up by the comment in server-save-buffers-kill-terminal:
>
> ;; 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.
>
> So I'd say your change is sensible, we should just update that comment
> to explain the differences in the "emulation".
Hmmmm OK, what about:
diff --git a/lisp/server.el b/lisp/server.el
index ff03cbe622..33e88409ca 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1666,13 +1666,16 @@ server-save-buffers-kill-terminal
(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.
+ ;; If the client has buffers, offer to save only those
+ ;; buffers. Otherwise, this is similar to a normal Emacs
+ ;; exit (where we offer to save all buffers) with the
+ ;; exception that, if ARG is nil, then passing nil as the
+ ;; PRED argument to `save-some-buffers' ensures
+ ;; `save-some-buffers-default-predicate' is respected.
(save-some-buffers
arg (if buffers
(lambda () (memq (current-buffer) buffers))
- t))
+ (and arg t)))
(server-delete-client proc)))
(t (error "Invalid client frame")))))
I tried to make it terser, but couldn't. If the indentation looks off,
it's not, it's because I untabified the changed regions.
If nobody complains I'll push this in a few days' time.
João
next prev parent reply other threads:[~2018-06-25 11:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-23 16:22 bug#31951: 27.0.50; [PATCH] server-save-buffers-kill-terminal should respect save-some-buffers-default-predicate João Távora
2018-06-24 13:37 ` Noam Postavsky
2018-06-24 20:22 ` João Távora
2018-06-24 20:46 ` Noam Postavsky
2018-06-25 11:07 ` João Távora [this message]
2018-06-26 1:53 ` Noam Postavsky
2018-06-26 19:27 ` João Távora
2018-06-27 13:20 ` João Távora
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8736xbm8ep.fsf@gmail.com \
--to=joaotavora@gmail.com \
--cc=31951@debbugs.gnu.org \
--cc=npostavs@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.