unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Eric Abrahamsen <eric@ericabrahamsen.net>,
	Emacs developers <emacs-devel@gnu.org>,
	 Stefan Monnier <monnier@iro.umontreal.ca>,
	Eli Zaretskii <eliz@gnu.org>
Subject: Re: [Emacs-diffs] emacs-26 ee512e9: Ignore buffers whose name begins with a space in save-some-buffers
Date: Wed, 20 Sep 2017 02:10:11 +0000	[thread overview]
Message-ID: <CAFyQvY1xuCCN0D8eC+dh838=kyvaBkvOD-6ZyeM_BowGsDnZKQ@mail.gmail.com> (raw)
In-Reply-To: <87inge8skl.fsf@ericabrahamsen.net>

[-- Attachment #1: Type: text/plain, Size: 2402 bytes --]

On Tue, Sep 19, 2017 at 2:14 PM Eric Abrahamsen <eric@ericabrahamsen.net>
wrote:

>
> I've played with this a bit, and am getting hung up on the (and pred...
> part above. "pred" is nil unless someone's customized
> `save-some-buffers-default-predicate', so in the majority of cases the
> check won't even reach `buffer-offer-save'.
>

Wow! That (and pred.. ) section has been there since the genesis of
files.el in 1991 by Roland McGrath:
http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=b4da00e92a09a2ee2cfb5df2ec111636c66e1597

(Thanks to vc-region-history.)

It was named exiting.. and at some point got renamed to pred. So it looks
like, by design buffer-offer-save was checked only at the time of exiting
emacs i.e. during the call to save-some-buffers within
save-buffer-kill-emacs.

>  I don't really know why that (and pred... is in there, and don't feel
comfortable just yanking it out.

Yes, given that it had always been there.

The pred will be true automatically at the time of quitting emacs (aptly
because earlier that var was called 'exiting').. but not when you call C-x
s.

So looks like along with setting buffer-offer-save to t, you would also
need to set save-some-buffers-default-predicate to t locally for the
special buffers you need saving.

How about this as a solution? With this, you only need to set
buffer-over-save.

diff --git a/lisp/files.el b/lisp/files.el
index 0c30d40c13..5c05e3168b 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -5188,15 +5188,15 @@ save-some-buffers
        (and (buffer-live-p buffer)
     (buffer-modified-p buffer)
                     (not (buffer-base-buffer buffer))
-                    (not (eq (aref (buffer-name buffer) 0) ?\s))
                     (or
                      (buffer-file-name buffer)
                      (and pred
                           (progn
                             (set-buffer buffer)
                             (and buffer-offer-save (> (buffer-size) 0))))
-                     (buffer-local-value
-                      'write-contents-functions buffer))
+                     (and buffer-offer-save
+                          (buffer-local-value
+                           'write-contents-functions buffer)))
                     (or (not (functionp pred))
                         (with-current-buffer buffer (funcall pred)))
                     (if arg

Stefan? Eli?
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 3681 bytes --]

  reply	other threads:[~2017-09-20  2:10 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170918202953.21378.63492@vcs0.savannah.gnu.org>
     [not found] ` <20170918202955.5043420AC4@vcs0.savannah.gnu.org>
2017-09-19  2:44   ` [Emacs-diffs] emacs-26 ee512e9: Ignore buffers whose name begins with a space in save-some-buffers Stefan Monnier
2017-09-19  3:12     ` Eric Abrahamsen
2017-09-19 12:42       ` Stefan Monnier
2017-09-19 13:25         ` Kaushal Modi
2017-09-19 15:44           ` Eric Abrahamsen
2017-09-19 15:50             ` Kaushal Modi
2017-09-19 15:53             ` Stefan Monnier
2017-09-19 16:03               ` Eric Abrahamsen
2017-09-19 15:37         ` Leo Liu
2017-09-19 15:56           ` Stefan Monnier
2017-09-19 10:48     ` Kaushal Modi
2017-09-19 12:08       ` Stefan Monnier
2017-09-19 12:26         ` Kaushal Modi
2017-09-19 18:13           ` Eric Abrahamsen
2017-09-20  2:10             ` Kaushal Modi [this message]
2017-09-20  7:16               ` Andreas Schwab
2017-09-20 17:14               ` Eric Abrahamsen
2017-09-21  8:01                 ` Eli Zaretskii
2017-09-21 19:57                   ` Eric Abrahamsen
2017-09-21 20:10                     ` Kaushal Modi
2017-09-21 22:53                       ` Eric Abrahamsen
2017-09-22  6:54                     ` Eli Zaretskii
2017-09-22 15:52                       ` Eric Abrahamsen
2017-09-22 16:18                         ` Stefan Monnier
2017-09-22 16:54                           ` Eric Abrahamsen
2017-09-22 19:03                             ` Stefan Monnier
2017-09-22 23:27                               ` Eric Abrahamsen
2017-09-23  2:43                                 ` Stefan Monnier
2017-09-24 19:25                           ` Eric Abrahamsen
2017-09-24 19:29                             ` Stefan Monnier
2017-09-24 20:59                               ` Eric Abrahamsen
2017-09-22 17:21                         ` Eli Zaretskii
2017-09-22 17:57                           ` Eric Abrahamsen

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFyQvY1xuCCN0D8eC+dh838=kyvaBkvOD-6ZyeM_BowGsDnZKQ@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=eric@ericabrahamsen.net \
    --cc=monnier@iro.umontreal.ca \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).