GNU bug report logs - #31951
27.0.50; [PATCH] server-save-buffers-kill-terminal should respect save-some-buffers-default-predicate

Previous Next

Package: emacs;

Reported by: João Távora <joaotavora <at> gmail.com>

Date: Sat, 23 Jun 2018 16:24:02 UTC

Severity: minor

Tags: patch

Found in version 27.0.50

Done: João Távora <joaotavora <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: João Távora <joaotavora <at> gmail.com>
Subject: bug#31951: closed (Re: bug#31951: 27.0.50; [PATCH]
 server-save-buffers-kill-terminal should respect save-some-buffers-default-predicate)
Date: Wed, 27 Jun 2018 13:22:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#31951: 27.0.50; [PATCH] server-save-buffers-kill-terminal should respect save-some-buffers-default-predicate

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 31951 <at> debbugs.gnu.org.

-- 
31951: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=31951
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: João Távora <joaotavora <at> gmail.com>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 31951-done <at> debbugs.gnu.org, 31951 <at> debbugs.gnu.org
Subject: Re: bug#31951: 27.0.50;
 [PATCH] server-save-buffers-kill-terminal should respect
 save-some-buffers-default-predicate
Date: Wed, 27 Jun 2018 14:20:54 +0100
Noam Postavsky <npostavs <at> gmail.com> writes:

> João Távora <joaotavora <at> gmail.com> writes:
>
>> I tried to make it terser, but couldn't.
>
> Hmm, maybe just concentrate on the save-some-buffers-default-predicate
> thing.  I think the original comment pretty much redundantly repeats
> what the doc string (and the code itself) say.
>
> --- i/lisp/server.el
> +++ w/lisp/server.el
> @@ -1639,13 +1639,15 @@ 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.
>  	     (save-some-buffers
>  	      arg (if buffers
> -		      (lambda () (memq (current-buffer) buffers))
> -		    t))
> +                      ;; Only files from emacsclient file list.
> +                      (lambda () (memq (current-buffer) buffers))
> +                    ;; No emacsclient file list: don't override
> +                    ;; `save-some-buffers-default-predicate' (unless
> +                    ;; ARGS is non-nil), since we're not killing
> +                    ;; Emacs (unlike `save-buffers-kill-emacs').
> +                    (and arg t)))
>  	     (server-delete-client proc)))
>  	  (t (error "Invalid client frame")))))
>  


Pushed as ce54573dacaeb234ac006b71cbaafe1c543515f1.

Thanks,
João


[Message part 3 (message/rfc822, inline)]
From: João Távora <joaotavora <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; [PATCH] server-save-buffers-kill-terminal should respect
 save-some-buffers-default-predicate
Date: Sat, 23 Jun 2018 17:22:48 +0100
Hi,

If the Emacs client was started without an explicit list of buffers to
edit, save-some-buffers is called with t for PRED (save all buffers),
but that was before save-some-buffers-default-predicate existed.

I don't see any reason why save-some-buffers-default-predicate shouldn't
be respected in server-save-buffers-kill-terminal (of course if ARG is
non-nil, we do pass t so that the previous behaviour remains).

Trivial patch attached,
João

diff --git a/lisp/server.el b/lisp/server.el
index ff03cbe622..ac14ef314e 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1670,9 +1670,9 @@ server-save-buffers-kill-terminal
 	     ;; 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))
+	      arg (and buffers
+		       (lambda () (memq (current-buffer) buffers))
+                       (and arg t)))
 	     (server-delete-client proc)))
 	  (t (error "Invalid client frame")))))



This bug report was last modified 7 years and 22 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.