From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.devel 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 Message-ID: <87poafkigg.fsf@ericabrahamsen.net> References: <20170918202953.21378.63492@vcs0.savannah.gnu.org> <20170918202955.5043420AC4@vcs0.savannah.gnu.org> <87inge8skl.fsf@ericabrahamsen.net> <878th9z40r.fsf@ericabrahamsen.net> <831sn0fpk9.fsf@gnu.org> <87o9q3lt8s.fsf@ericabrahamsen.net> <83zi9ncjg2.fsf@gnu.org> <87d16iivcx.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1506281162 27914 195.159.176.226 (24 Sep 2017 19:26:02 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 24 Sep 2017 19:26:02 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 24 21:25:55 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dwCXH-0006fl-S4 for ged-emacs-devel@m.gmane.org; Sun, 24 Sep 2017 21:25:51 +0200 Original-Received: from localhost ([::1]:39168 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwCXP-0000j4-7t for ged-emacs-devel@m.gmane.org; Sun, 24 Sep 2017 15:25:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwCWm-0000hS-B4 for emacs-devel@gnu.org; Sun, 24 Sep 2017 15:25:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwCWj-0004i7-3P for emacs-devel@gnu.org; Sun, 24 Sep 2017 15:25:20 -0400 Original-Received: from [195.159.176.226] (port=55491 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dwCWi-0004fH-OD for emacs-devel@gnu.org; Sun, 24 Sep 2017 15:25:17 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dwCWW-0003nv-2s for emacs-devel@gnu.org; Sun, 24 Sep 2017 21:25:04 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 46 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:cCPMJqpgykEEE2eO05JZYAawC9Q= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:218755 Archived-At: Stefan Monnier 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 unjustified. A less logically-tangled version might look like: (or (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 issue. How does this look? Eric