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: Wed, 20 Sep 2017 10:14:12 -0700 Message-ID: <878th9z40r.fsf@ericabrahamsen.net> References: <20170918202953.21378.63492@vcs0.savannah.gnu.org> <20170918202955.5043420AC4@vcs0.savannah.gnu.org> <87inge8skl.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1505927748 5557 195.159.176.226 (20 Sep 2017 17:15:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 20 Sep 2017 17:15:48 +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 Wed Sep 20 19:15:44 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 1duibA-0001Ac-9S for ged-emacs-devel@m.gmane.org; Wed, 20 Sep 2017 19:15:44 +0200 Original-Received: from localhost ([::1]:49869 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duibH-0008B9-FX for ged-emacs-devel@m.gmane.org; Wed, 20 Sep 2017 13:15:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duia3-0007Rh-R9 for emacs-devel@gnu.org; Wed, 20 Sep 2017 13:14:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duia1-0000ST-4P for emacs-devel@gnu.org; Wed, 20 Sep 2017 13:14:35 -0400 Original-Received: from [195.159.176.226] (port=35092 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1duia0-0000Rt-Sb for emacs-devel@gnu.org; Wed, 20 Sep 2017 13:14:33 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1duiZh-00053W-4Z for emacs-devel@gnu.org; Wed, 20 Sep 2017 19:14:13 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 51 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:Iim5kIL6dy3JZC9qPKNsufRWfoQ= 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:218595 Archived-At: Kaushal Modi writes: > On Tue, Sep 19, 2017 at 2:14 PM Eric Abrahamsen wrote: > > I've played with this a bit, and am getting hung up on the (and pred... > part above. "pred" is nil unless someone's customized > `save-some-buffers-default-predicate', so in the majority of cases the > check won't even reach `buffer-offer-save'. > > Wow! That (and pred.. ) section has been there since the genesis of files.el in 1991 by Roland McGrath: http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=b4da00e92a09a2ee2cfb5df2ec111636c66e1597 > > (Thanks to vc-region-history.) > > It was named exiting.. and at some point got renamed to pred. So it looks like, by design buffer-offer-save was checked only at the time of exiting emacs i.e. during the call to save-some-buffers within save-buffer-kill-emacs. Thanks for doing the legwork! At least that gives us some confidence in altering it. [...] > 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. Eric