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: Tino Calancha
Subject: bug#46374: 28.0.50; Ask me to save buffers only if they are under callers dir
Date: Sun, 07 Mar 2021 21:34:13 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Sorry for the late response: many meetings with investors.
Then I went on a vacation to my castle in Seychelles.


Eli Zaretskii <eliz@gnu.org> writes:
>> You are assuming that when save-some-buffers runs, the default
>> directory is the same as when you issued whatever command triggered
>> the call to save-some-buffers?  Is that assumption really accurate?
I don't know if there are some corner cases.
In my experience, I am hit by this (very often) when using packages
that call `compilation-start`.  Prominent examples are `rgrep` or
when downloading ELPA updates (they will trigger a compilation as well).
The patch is serving me very well so far.


Juri Linkov <juri@linkov.net> writes:
>>  @vindex save-some-buffers-default-predicategn
>> +@vindex save-some-buffers-restrict-to-caller-subdirs
>>  You can customize the value of
>> -@code{save-some-buffers-default-predicate} to control which buffers
>> -Emacs will ask about.
>> +@code{save-some-buffers-default-predicate} and
>> +@code{save-some-buffers-restrict-to-caller-subdirs} to control which
>> +buffers Emacs will ask about.
>
> Why not simply add a new option to the existing variable
> save-some-buffers-default-predicate?  For example:
>
> (defcustom save-some-buffers-default-predicate nil
>   "Default predicate for `save-some-buffers'."
>   :group 'auto-save
>   ;; FIXME nil should not be a valid option, let alone the default,
>   ;; eg so that add-function can be used.
>   :type '(choice (const :tag "Default" nil)
>                  (const :tag "Subdirs of default directory" default-directory)
>                  (const :tag "Project root" project-root)
>                  function)

Indeed, this was my initial implemention.
Then I moved to the one I shared here; I found my second version
superior for the following reason:

1. Users can restrict the buffer default directory AND still pass a
   predicate to filter by any other thing they wish;
   i.e. you don't need to chose either one of the other.

2. I find it cleaner having it in a separated option.


Stefan Monnier <monnier@iro.umontreal.ca>
>> If we want to have such a behavior and make it optional, it's fine by me.
It's optional in my patch; some people might like the current situation:
been prompted about any modified buffer.

>> But if we want to make it a default behavior, then I think
>> `project-root` would be much a much better choice (when available) than
>> `default-directory`.

Would this `project-root` feature work for `rgrep`?
I mean, I can call `rgrep` in my local computer, out of any project, for
instance to search for information in some plain text notes.  In this
case, `default-directory` works quite well.





reply via email to

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