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: Fri, 22 Sep 2017 10:57:16 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> From: Eric Abrahamsen <address@hidden>
>> Date: Fri, 22 Sep 2017 08:52:30 -0700
>> 
>> (and pred
>>      (progn
>>        (set-buffer buffer)
>>        (and buffer-offer-save (> (buffer-size) 0))))
>> 
>> Unless a user has customized `save-some-buffers-default-predicate', PRED
>> is only t when Emacs is exiting.
>> 
>> I don't understand why it's being used this way, or why
>> `save-some-buffers' should behave differently when called interactively
>> vs when Emacs is exiting, but I didn't want to touch it because, as has
>> been pointed out, it's been this way for decades.
>
> Does VCS history explain why PRED is used like that?

Sort of. Kaushal and Andreas pointed out that the argument used to be
(since 1986) called EXITING, and was a plain boolean: so far, so clear.

Then, in 2000 or so (ffc0e1caf1a6c8636d0c6a1f3c1650deee845916), the
argument was changed to PRED, and was allowed to be a function as well.
The (and pred...) part was left alone (that's the boolean test), and
this bit was added:

(or (not (functionp pred))
    (with-current-buffer buffer (funcall pred)))

Then earlier in 2017 the new variable
`save-some-buffers-default-predicate' was added, and this code
introduced:

(unless pred
  (setq pred save-some-buffers-default-predicate))

Mostly it just feels wrong that an argument that was once explicitly for
changing behavior at exit time, now is mixed up with a user option that
will always be in effect.

It seems like there are three things to take into consideration:

1. Is `save-some-buffers-default-predicate' a function? If so, and it
   returns t, should we ignore all the other flags and knobs?
2. Is `buffer-offer-save' t, and if so, should we ignore all the other
   flags and knobs?
3. Should we provide different behavior when exiting Emacs?

Right now 1 and 3 are a bit tangled up.

I'm trying to think of a case where someone has set `buffer-offer-save'
non-nil in a buffer, but *only* wants that buffer to be offered for save
when Emacs is exiting, not when the user hits "C-x s".




reply via email to

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