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: Fri, 22 Sep 2017 10:57:16 -0700 Message-ID: <87k20q4nwj.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> <83bmm2d4zk.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1506103060 5957 195.159.176.226 (22 Sep 2017 17:57:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 22 Sep 2017 17:57:40 +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 Fri Sep 22 19:57:36 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 1dvSCi-00017z-Td for ged-emacs-devel@m.gmane.org; Fri, 22 Sep 2017 19:57:33 +0200 Original-Received: from localhost ([::1]:60425 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvSCq-0003id-53 for ged-emacs-devel@m.gmane.org; Fri, 22 Sep 2017 13:57:40 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvSCh-0003iS-0s for emacs-devel@gnu.org; Fri, 22 Sep 2017 13:57:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dvSCd-0005W7-On for emacs-devel@gnu.org; Fri, 22 Sep 2017 13:57:31 -0400 Original-Received: from [195.159.176.226] (port=41209 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dvSCd-0005Uq-Gy for emacs-devel@gnu.org; Fri, 22 Sep 2017 13:57:27 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dvSCS-0000DV-3o for emacs-devel@gnu.org; Fri, 22 Sep 2017 19:57:16 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 55 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:hFAwOr3JI+XXM01896m6oqvwBIc= 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:218693 Archived-At: Eli Zaretskii writes: >> From: Eric Abrahamsen >> 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".