unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: emacs-devel@gnu.org
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	[thread overview]
Message-ID: <871smzll2x.fsf@ericabrahamsen.net> (raw)
In-Reply-To: CAFyQvY2w+6Hd7j1DkCUFadgDnzZ0qH4CQXqE6ZL7exMVsNuRKA@mail.gmail.com

Kaushal Modi <kaushal.modi@gmail.com> writes:

> On Thu, Sep 21, 2017 at 3:58 PM Eric Abrahamsen <eric@ericabrahamsen.net> 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.




  reply	other threads:[~2017-09-21 22:53 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170918202953.21378.63492@vcs0.savannah.gnu.org>
     [not found] ` <20170918202955.5043420AC4@vcs0.savannah.gnu.org>
2017-09-19  2:44   ` [Emacs-diffs] emacs-26 ee512e9: Ignore buffers whose name begins with a space in save-some-buffers Stefan Monnier
2017-09-19  3:12     ` Eric Abrahamsen
2017-09-19 12:42       ` Stefan Monnier
2017-09-19 13:25         ` Kaushal Modi
2017-09-19 15:44           ` Eric Abrahamsen
2017-09-19 15:50             ` Kaushal Modi
2017-09-19 15:53             ` Stefan Monnier
2017-09-19 16:03               ` Eric Abrahamsen
2017-09-19 15:37         ` Leo Liu
2017-09-19 15:56           ` Stefan Monnier
2017-09-19 10:48     ` Kaushal Modi
2017-09-19 12:08       ` Stefan Monnier
2017-09-19 12:26         ` Kaushal Modi
2017-09-19 18:13           ` Eric Abrahamsen
2017-09-20  2:10             ` Kaushal Modi
2017-09-20  7:16               ` Andreas Schwab
2017-09-20 17:14               ` Eric Abrahamsen
2017-09-21  8:01                 ` Eli Zaretskii
2017-09-21 19:57                   ` Eric Abrahamsen
2017-09-21 20:10                     ` Kaushal Modi
2017-09-21 22:53                       ` Eric Abrahamsen [this message]
2017-09-22  6:54                     ` Eli Zaretskii
2017-09-22 15:52                       ` Eric Abrahamsen
2017-09-22 16:18                         ` Stefan Monnier
2017-09-22 16:54                           ` Eric Abrahamsen
2017-09-22 19:03                             ` Stefan Monnier
2017-09-22 23:27                               ` Eric Abrahamsen
2017-09-23  2:43                                 ` Stefan Monnier
2017-09-24 19:25                           ` Eric Abrahamsen
2017-09-24 19:29                             ` Stefan Monnier
2017-09-24 20:59                               ` Eric Abrahamsen
2017-09-22 17:21                         ` Eli Zaretskii
2017-09-22 17:57                           ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871smzll2x.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).