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: Kaushal Modi
Subject: Re: [Emacs-diffs] emacs-26 ee512e9: Ignore buffers whose name begins with a space in save-some-buffers
Date: Tue, 19 Sep 2017 12:26:02 +0000

On Tue, Sep 19, 2017 at 8:08 AM Stefan Monnier <address@hidden> wrote:

But, how does your example satisfy this part of the code:

                    (or
                     (buffer-file-name buffer)
                     (and pred
                          (progn
                            (set-buffer buffer)
                            (and buffer-offer-save (> (buffer-size) 0)))))

That is the old code pre-commit 9b980e2[1]. That worked fine.
 
does " *Code-Fontify*" have buffer-file-name non-nil or does it have
buffer-offer-save non-nil? 

No, but write-contents-functions is non-nil in " *Code-Fontify*" buffer (see below).
 
If not, I can't see how you could get
prompted, but maybe I'm missing something.

Post-commit 9b980e2[1], the newly-added 3rd segment to that OR starting evalling true for my use case:

(or
 (buffer-file-name buffer)
 (and pred
      (progn
        (set-buffer buffer)
        (and buffer-offer-save (> (buffer-size) 0))))
 (buffer-local-value                                  ;THIS was the newly added condition
  'write-contents-functions buffer))
    
> ANDing the internal buffer check with OR of the 2 cases you mentioned will
> work fine (won't undo the fix that Eric made in this commit).

But it will stop prompting for buffers with a leading space but where
buffer-offer-save is explicitly set to a non-nil value, which I think is
a bug.

How about changing the location of that internal-buffer check?

i.e. change:

(buffer-local-value
  'write-contents-functions buffer)

to:

(and (buffer-local-value
      'write-contents-functions buffer)
     (not (eq (aref (buffer-name buffer) 0) ?\s)))       

@Eric: That makes me wonder.. is it possible to not add this 3rd condition in the or and instead just set buffer-offer-save in the special buffers in your use-case?

[1]: http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=9b980e2691afa3a7a967011fc004d352750fe618 
--

Kaushal Modi


reply via email to

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