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 08:52:30 -0700 Message-ID: <87d16iivcx.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> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1506096213 17081 195.159.176.226 (22 Sep 2017 16:03:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 22 Sep 2017 16:03:33 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 22 18:03:29 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 1dvQQL-00047p-4i for ged-emacs-devel@m.gmane.org; Fri, 22 Sep 2017 18:03:29 +0200 Original-Received: from localhost ([::1]:59716 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvQQS-0007j7-8b for ged-emacs-devel@m.gmane.org; Fri, 22 Sep 2017 12:03:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvQG3-0006Vm-Bm for emacs-devel@gnu.org; Fri, 22 Sep 2017 11:52:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dvQFy-0003Sr-LG for emacs-devel@gnu.org; Fri, 22 Sep 2017 11:52:50 -0400 Original-Received: from [195.159.176.226] (port=59627 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dvQFy-0003SH-Dt for emacs-devel@gnu.org; Fri, 22 Sep 2017 11:52:46 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dvQFk-0004Xd-9e for emacs-devel@gnu.org; Fri, 22 Sep 2017 17:52:32 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 63 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:C3gNUDIb2FWOqY1pXfRRtCB8TUo= 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:218688 Archived-At: Eli Zaretskii writes: >> From: Eric Abrahamsen >> Date: Thu, 21 Sep 2017 12:57:39 -0700 >> >> > Are there any upsides and downsides to consider wrt this solution? If >> > so, what are they? >> >> It isn't so much upsides and downsides, as being careful to add a single >> bit of functionality, without messing up present behavior and >> expectations for a highly-trafficked bit of code. I think we can agree: >> >> 1. To leave the buffer name out of it (don't handle leading spaces >> differently) >> 2. To require `buffer-offer-save' to be explicitly set non-nil in order >> to to consider a non-file buffer for potential saving. I think >> Kaushal's right that we should require both `buffer-offer-save' and >> `write-contents-functions' to be non-nil >> 3. To leave the current behavior of the PRED argument unchanged >> >> So I think Kaushal's solution is good: it won't change anything at all >> except to add a clause saying "when `buffer-offer-save' and >> `write-contents-functions' have been set non-nil, consider the buffer >> for saving". That's only going to happen when someone explicitly >> requests it. > > Reusing buffer-offer-save for this purpose sounds a strange solution > for me. That variable already says that Emacs should offer saving the > buffer, and now it will have to do double duty in a convoluted manner. > It sounds like we are making the problem harder, rather than simpler, > for modes to solve. It's appearing twice (which admittedly probably a bad idea), but it isn't doing double duty: in both cases it simply means that the buffer should be unilaterally offered for save, regardless of other checks. > IOW, if we require buffer-offer-save to be non-nil, why do we need to > also require that write-contents-functions is non-nil? There are 2 > clauses in the condition we are talking about, both require > buffer-offer-save to be non-nil, and the only difference between them > seems to be the condition of buffer size being positive. Is that what > write-contents-functions is about -- to allow saving "empty" buffers? No, it isn't. `write-contents-functions' doesn't need to be in there -- you're right that `buffer-offer-save' should be sufficient -- but then we'll need to adjust handling of PRED somehow, which is currently being slightly mis-used as a boolean when Emacs is exiting: (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. If we can come to a consensus about those two questions, it shouldn't be hard to come up with a clean solution.