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


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
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: bug#46374: 28.0.50; Ask me to save buffers only if they are under callers dir
Date: Wed, 17 Mar 2021 19:10:15 +0200
> 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).

This should work.  Then in save-some-buffers it's possible
to add after the existing 2 lines:

  (unless pred
    (setq pred save-some-buffers-default-predicate))

only 3 additional lines:

  (let ((pred-fun (and (functionp pred) (funcall pred))))
    (when (functionp pred-fun)
      (setq pred pred-fun)))

Then a pred function could contain something like:

  (lambda ()
    (let ((project-dir (or (project-root (project-current)) default-directory)))
      (lambda () (file-in-directory-p default-directory project-dir))))




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.