bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#46374: 28.0.50; Ask me to save buffers only if they are under caller


From: Juri Linkov
Subject: bug#46374: 28.0.50; Ask me to save buffers only if they are under callers dir
Date: Sun, 25 Apr 2021 01:13:13 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>>> I have noticed that I haven't enabled lexical-binding in my .emacs file,
>>> which it is crucial for my use case.
>>> To avoid surprises, I have mentioned this issue in the docstring.
>>
>> Unfortunately, your patch is truncated.  Could you send a complete patch?
>
> Here is:

Thanks.  Your first patch was better in terms of customizability.
It allowed the users to easily customize the used predicate,
but its disadvantage was that it introduced a new defcustom.

Would it be possible to merge the advantage of your first patch
with the cleaner solution of your latest patch?

> +(defvar save-some-buffers-fun-function (lambda () 
> save-some-buffers-default-predicate)

Maybe it's possible to hard-code this as the default option of the
existing defcustom save-some-buffers-default-predicate?

Currently there is such FIXME comment in save-some-buffers-default-predicate:

  ;; FIXME nil should not be a valid option, let alone the default,
  ;; eg so that add-function can be used.

Is it possible to add the default value as a function that returns nil?
This will implement FIXME, and will allow adding more options
with more predicates:

> +\(lambda ()
> +  (let ((project-dir
> +         (or (and (project-current) (project-root (project-current)))
> +             default-directory)))
> +    (lambda () (file-in-directory-p default-directory project-dir))))

Then this code could be implemented as an additional option for
save-some-buffers-default-predicate.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]