[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: |
Mon, 15 Mar 2021 19:10:02 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
>> This means reusing the existing save-some-buffers-default-predicate
>> would be still preferable that guarantees backward-compatibility.
>> When it's customized to a predicate to filter out non-current subdirs,
>> then such call '(save-some-buffers t (lambda () (derived-mode-p 'org-mode)))'
>> still overrides the customized value. This is the right thing to do.
>
> OK, back to my original implementation (i.e., adding a new option
> to `save-some-buffers-default-predicate`).
>
> I have been playing with the followig patch this morning.
> - it only adds a new option 'project-root
> - in case there is not a root there, then `default-directory` is taken
> (this is a requirement from the OP, that ie me :-)
> - this patch doesn't interfere with the 2nd argument of `save-some-buffers'.
>
> Please, try it:
Thanks, I tried it. The only problem is that the value 'project-root'
is hard-coded. Would it be possible to create a real function from it?
This will require giving a proper prefix to it, indeed, such as e.g.
'save-some-buffers-project-root'. But this will allow greater customization.
For example, everyone could copy its default implementation to the init file
and modify its logic to check separately project-root from subdirs, etc.
Also it will remove unnecessary details of getting the project root
from the implementation of 'save-some-buffers', and to avoid the need
to preload project.el.
Is it a problem that such separate function can't get
information about the original default-directory when
called as: (with-current-buffer buffer (funcall pred))?
Actually, this is the shortcoming of the old design of
save-some-buffers-default-predicate. Is it possible to add
a new arg (with an original dir) to the predicate function?
Then for backward-compatibility before calling it, the function arity
could be checked, then called with one arg when it's accepted
by the function, otherwise call without args.
- bug#46374: 28.0.50; Ask me to save buffers only if they are under callers dir, Tino Calancha, 2021/03/07
- bug#46374: 28.0.50; Ask me to save buffers only if they are under callers dir, Juri Linkov, 2021/03/07
- Message not available
- bug#46374: 28.0.50; Ask me to save buffers only if they are under callers dir, Juri Linkov, 2021/03/08
- bug#46374: 28.0.50; Ask me to save buffers only if they are under callers dir, Tino Calancha, 2021/03/14
- bug#46374: 28.0.50; Ask me to save buffers only if they are under callers dir,
Juri Linkov <=
- bug#46374: 28.0.50; Ask me to save buffers only if they are under callers dir, Juri Linkov, 2021/03/16
- bug#46374: 28.0.50; Ask me to save buffers only if they are under callers dir, Stefan Monnier, 2021/03/16
- bug#46374: [External] : bug#46374: 28.0.50; Ask me to save buffers only if they are under callers dir, Drew Adams, 2021/03/16
- bug#46374: [External] : bug#46374: 28.0.50; Ask me to save buffers only if they are under callers dir, Juri Linkov, 2021/03/17
- bug#46374: 28.0.50; Ask me to save buffers only if they are under callers dir, Juri Linkov, 2021/03/17
- bug#46374: 28.0.50; Ask me to save buffers only if they are under callers dir, Tino Calancha, 2021/03/21
- bug#46374: 28.0.50; Ask me to save buffers only if they are under callers dir, Juri Linkov, 2021/03/21