GNU bug report logs -
#46374
28.0.50; Ask me to save buffers only if they are under callers dir
Previous Next
Reported by: Tino Calancha <tino.calancha <at> gmail.com>
Date: Sun, 7 Feb 2021 22:33:01 UTC
Severity: wishlist
Tags: fixed
Merged with 50380
Fixed in version 28.0.60
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
Message #32 received at 46374 <at> debbugs.gnu.org (full text, mbox):
>> OK, back to my original implementation (i.e., adding a new option
>> to `save-some-buffers-default-predicate`).
>
> 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.
I meant to replace in 'save-some-buffers'
(with-current-buffer buffer (funcall pred))
with
(let ((one-arg (equal (func-arity pred) '(1 . 1))))
(dolist (buffer (buffer-list))
(if one-arg
(funcall pred buffer)
(with-current-buffer buffer (funcall pred))))
Then 'default-directory' of the original buffer will be preserved
inside the pred function, so it will be possible to call the pred function
with one arg 'buffer' and check whether the buffer is under the original
'default-directory' with
(file-in-directory-p (buffer-local-value 'default-directory buffer)
default-directory)
This bug report was last modified 3 years and 192 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.