GNU bug report logs - #65704
29.1; Most code of `project-ignores' seems to be dead code

Previous Next

Package: emacs;

Reported by: Damien Cassou <damien <at> cassou.me>

Date: Sat, 2 Sep 2023 16:04:01 UTC

Severity: wishlist

Found in version 29.1

Done: Dmitry Gutov <dmitry <at> gutov.dev>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Damien Cassou <damien <at> cassou.me>, 65704 <at> debbugs.gnu.org
Subject: bug#65704: 29.1; Most code of `project-ignores' seems to be dead code
Date: Tue, 5 Sep 2023 17:09:45 +0300
Hi Damien,

On 05/09/2023 10:58, Damien Cassou wrote:
> Hi Dmitry,
> 
> Dmitry Gutov<dmitry <at> gutov.dev>  writes:
>> Perhaps you have an older version installed somewhere?
> I think I experimented a bit too much 😄, thanks for noticing. I
> restarted Emacs and am now using project 0.9.8 from elpa. The expression
> (project-current) now returns (vc nil "…/client/") in my client/
> directory.

I'm still not sure about the relative path in the 3rd element, but if it 
doesn't cause problems, let's set it aside for now.

> Notice the nil in the second position. This means that
> `project-files' for 'vc will set nil as backend. As a result, the
> optimized `project--vc-list-files' isn't used. This means the files
> listed in client/.gitignore are not ignored.
> 
> I'm certainly doing something wrong again.

And that... is a geniune bug. ;-(

Or an omission compared to the design I had in my head (mentioned 
upthread), but at least not a regression compared to the previous 
behavior or to what people did with adding to project-find-functions.

So I'm not 100% sure about changing that in Emacs 29, but here's a 
patch, please try it out:

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 29a81c7e151..2eea0ef72e0 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -566,6 +566,12 @@ project-try-vc
                (project--submodule-p root))
           (let* ((parent (file-name-directory (directory-file-name 
root))))
             (setq root (vc-call-backend 'Git 'root parent))))
+        (when (not backend)
+          (let* ((project-vc-extra-root-markers nil)
+                 ;; Avoid submodules scan.
+                 (enable-dir-local-variables nil)
+                 (parent (project-try-vc root)))
+            (and parent (setq backend (nth 1 parent)))))
         (when root
           (setq project (list 'vc backend root))
           ;; FIXME: Cache for a shorter time.





This bug report was last modified 1 year and 289 days ago.

Previous Next


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