emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] emacs-26 ee512e9: Ignore buffers whose name begins wit


From: Eric Abrahamsen
Subject: Re: [Emacs-diffs] emacs-26 ee512e9: Ignore buffers whose name begins with a space in save-some-buffers
Date: Wed, 20 Sep 2017 10:14:12 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Kaushal Modi <address@hidden> writes:

> On Tue, Sep 19, 2017 at 2:14 PM Eric Abrahamsen <address@hidden> 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.

Thanks for doing the legwork! At least that gives us some confidence in
altering it.

[...]

> 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?

As far as I can see, that's a good solution. Let's see what they say.

Eric




reply via email to

[Prev in Thread] Current Thread [Next in Thread]