[Top][All Lists]

[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: Sun, 24 Sep 2017 12:25:03 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> (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.
> But it's also non-nil in some other cases (e.g. it was non-nil when
> the function was called as a part of running a command in PCL-CVS, and
> presumably the VC-Dir interface should do the same, where the pred` is
> used to only prompt saving of buffers within the relevant directory).
>> If we can come to a consensus about those two questions, it shouldn't be
>> hard to come up with a clean solution.
> How 'bout turning buffer-offer-save into a 3-value variable (instead of
> a boolean):
> - nil = as before (i.e. never)
> - t = as before (i.e. only when pred is non-nil and the buffer is not empty)
> - `always` = regardless of pred and buffer's size (i.e. always)

On second thought, this seems like a good idea (sorry for the
gratuitous snark!).

Looking at the `buffer-offer-save' docstring, it does explicitly say it
only comes into effect at exit time, so my complaints were a bit

A less logically-tangled version might look like:

 (buffer-file-name buffer)
 (with-current-buffer buffer
   (or (eq buffer-offer-save 'always)
       (and pred buffer-offer-save (> (buffer-size) 0)))))

I still think that PRED-the-function and PRED-the-exiting-flag should be
separated out into two different arguments, but that's a different

How does this look?


reply via email to

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