From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: emacs-devel@gnu.org
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 [thread overview]
Message-ID: <87k20q4nwj.fsf@ericabrahamsen.net> (raw)
In-Reply-To: 83bmm2d4zk.fsf@gnu.org
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Eric Abrahamsen <eric@ericabrahamsen.net>
>> 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".
prev parent reply other threads:[~2017-09-22 17:57 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
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 [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k20q4nwj.fsf@ericabrahamsen.net \
--to=eric@ericabrahamsen.net \
--cc=emacs-devel@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.