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: Thu, 21 Sep 2017 15:53:58 -0700 Message-ID: <871smzll2x.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> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1506034460 32225 195.159.176.226 (21 Sep 2017 22:54:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 21 Sep 2017 22:54:20 +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 00:54:16 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 1dvAMK-000886-89 for ged-emacs-devel@m.gmane.org; Fri, 22 Sep 2017 00:54:16 +0200 Original-Received: from localhost ([::1]:55785 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvAMR-0001xV-OK for ged-emacs-devel@m.gmane.org; Thu, 21 Sep 2017 18:54:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvAMJ-0001xK-Q6 for emacs-devel@gnu.org; Thu, 21 Sep 2017 18:54:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dvAMG-00015H-Jn for emacs-devel@gnu.org; Thu, 21 Sep 2017 18:54:15 -0400 Original-Received: from [195.159.176.226] (port=39501 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dvAMG-00014C-CC for emacs-devel@gnu.org; Thu, 21 Sep 2017 18:54:12 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dvAM6-0007LG-6J for emacs-devel@gnu.org; Fri, 22 Sep 2017 00:54:02 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 44 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:D2CqzDgssCNBlplePscmkka/ob8= 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:218665 Archived-At: Kaushal Modi writes: > On Thu, Sep 21, 2017 at 3:58 PM Eric Abrahamsen wrote: > > 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. > > Thanks for the feedback.. I have some more food for thought: > > Case 1: We move forward with this AND condition of buffer-offer-save and write-contents-functions > > - Here one would need to set both buffer-offer-save and write-contents-functions for emacs to offer saving non-file buffers. > > Case 2: We revert this change that adds sensitivity to write-contents-functions > > - Here one would need to set both buffer-offer-save and save-some-buffers-default-predicate (can be set just locally in a buffer?) for emacs to offer saving non-file buffers. > > So in both cases, we would need to set 2 variables to some non-nil value. Is Case 1 then better than Case 2? In Case 2, we don't need to change any code (except for reverting 9b980e2[1] and ee512e9[2]). I'm still in favor of case 1. `save-some-buffers-default-predicate' is not buffer-local, and thus shouldn't be used by a single package author to specify that his/her buffers should be eligible for save. What if two packages both tried to use it? Though `save-some-buffers' slightly abuses it as a boolean, I think it's clear that this option should be left to the user. Also, it's docstring suggests that it's there to *stop* buffers from being offered for save. `buffer-offer-save', however, is buffer-local, meaning no one will step on anyone else's toes.