GNU bug report logs - #46374
28.0.50; Ask me to save buffers only if they are under callers dir

Previous Next

Package: emacs;

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 #35 received at 46374 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juri Linkov <juri <at> linkov.net>
Cc: 46374 <at> debbugs.gnu.org,
 Quách Mỹ Uyên Nhi <uyennhi.qm <at> gmail.com>,
 Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#46374: 28.0.50; Ask me to save buffers only if they are
 under callers dir
Date: Tue, 16 Mar 2021 18:54:12 -0400
>   (let ((one-arg (equal (func-arity pred) '(1 . 1))))

Please don't.  This will break down as soon as you set the function
with `add-function`.
[ I wish people could forget that `func-arity` exists.  Its use is
  a bug-in-the-waiting in most cases.  ]

>     (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)

How 'bout using something like `isearch-search-fun-function`:
i.e. *compute* the predicate by calling
save-some-buffers-predicate-function, so this function can return
a predicate that remembers the default-dir of the original buffer (or
any other aspect relevant to the state from which we started the
save-some-buffers).


        Stefan





This bug report was last modified 3 years and 193 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.