[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#31951: 27.0.50; [PATCH] server-save-buffers-kill-terminal should res
bug#31951: 27.0.50; [PATCH] server-save-buffers-kill-terminal should respect save-some-buffers-default-predicate
Mon, 25 Jun 2018 12:07:26 +0100
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
Noam Postavsky <address@hidden> writes:
> João Távora <address@hidden> 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
@@ -1666,13 +1666,16 @@ server-save-buffers-kill-terminal
(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.
arg (if buffers
(lambda () (memq (current-buffer) buffers))
+ (and arg t)))
(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.