Subject: Re: bug#46374: 28.0.50; Ask me to save buffers only if they are under callers dir

From: Eli Zaretskii <[email-masked]>
Date: Tue, 18 May 2021 21:23:37 +0300

> From: Tino Calancha <[email-masked]>
> Date: Tue, 18 May 2021 20:04:24 +0200 (CEST)
> cc: Tino Calancha <[email-masked]>, [email-masked], 
>     [email-masked], [email-masked], [email-masked]
> 
> On Thu, 29 Apr 2021, Eli Zaretskii wrote:
> 
> >> From: Tino Calancha <[email-masked]>
> >> Date: Wed, 28 Apr 2021 21:31:25 +0200
> >> Cc: [email-masked], Stefan Monnier <[email-masked]>,
> >>  Quách Mỹ Uyên Nhi
> >>  <[email-masked]>
> >>
> >> Juri Linkov <[email-masked]> writes:
> >>
> >> +(defcustom save-some-buffers-default-predicate save-some-buffers-default-fun
> >> +  "Generator function of the default predicate for `save-some-buffers'.
> >> +
> >> +It must be a function with no arguments that returns a predicate.
> >> +This predicate is called (with no parameters) from the buffer to be
> >> +saved.
> >
> > Reading this, I'm confused: a function that returns a predicate?  If
> > this is literally so, why do we need this two-step approach? why not
> > have the value _be_ a predicate function?
> 
> The point of this two-step approach is to get access to the caller 
> environment:
> 
> - We have a function, generate-foo, that builds a predicate foo.
> - By calling generate-foo inside same-some-buffers, we build a foo with
>    access to the enviroment, i.e. foo is a closure.
> 
> That makes the trick to restrict the prompt to saving buffers only inside 
> the current project.

IMNSHO, this is not a very good idea for a defcustom.  What user will
be able to provide such a function willy-nilly?