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 12:57:39 -0700 Message-ID: <87o9q3lt8s.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> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1506023911 26507 195.159.176.226 (21 Sep 2017 19:58:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 21 Sep 2017 19:58:31 +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 Thu Sep 21 21:58:28 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 1dv7cA-0006d9-0c for ged-emacs-devel@m.gmane.org; Thu, 21 Sep 2017 21:58:26 +0200 Original-Received: from localhost ([::1]:55306 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dv7cH-000545-6i for ged-emacs-devel@m.gmane.org; Thu, 21 Sep 2017 15:58:33 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35006) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dv7bf-00053f-KH for emacs-devel@gnu.org; Thu, 21 Sep 2017 15:57:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dv7bc-00008p-Ja for emacs-devel@gnu.org; Thu, 21 Sep 2017 15:57:55 -0400 Original-Received: from [195.159.176.226] (port=36267 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dv7bc-00007g-Bf for emacs-devel@gnu.org; Thu, 21 Sep 2017 15:57:52 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dv7bS-0004B8-Cf for emacs-devel@gnu.org; Thu, 21 Sep 2017 21:57:42 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 57 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:Lm5H0Wv8igHngtDCjCTDJfWpd5A= 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:218652 Archived-At: Eli Zaretskii writes: >> From: Eric Abrahamsen >> Date: Wed, 20 Sep 2017 10:14:12 -0700 >> >> > How about this as a solution? With this, you only need to set buffer-over-save. >> > >> > diff --git a/lisp/files.el b/lisp/files.el >> > index 0c30d40c13..5c05e3168b 100644 >> > --- a/lisp/files.el >> > +++ b/lisp/files.el >> > @@ -5188,15 +5188,15 @@ save-some-buffers >> > (and (buffer-live-p buffer) >> > (buffer-modified-p buffer) >> > (not (buffer-base-buffer buffer)) >> > - (not (eq (aref (buffer-name buffer) 0) ?\s)) >> > (or >> > (buffer-file-name buffer) >> > (and pred >> > (progn >> > (set-buffer buffer) >> > (and buffer-offer-save (> (buffer-size) 0)))) >> > - (buffer-local-value >> > - 'write-contents-functions buffer)) >> > + (and buffer-offer-save >> > + (buffer-local-value >> > + 'write-contents-functions buffer))) >> > (or (not (functionp pred)) >> > (with-current-buffer buffer (funcall pred))) >> > (if arg >> > >> > Stefan? Eli? >> >> As far as I can see, that's a good solution. Let's see what they say. > > 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. Eric