GNU bug report logs - #72300
project.el: detect newly created project contained within another

Previous Next

Package: emacs;

Reported by: Federico Tedin <federicotedin <at> gmx.de>

Date: Thu, 25 Jul 2024 19:55:02 UTC

Severity: normal

Full log


Message #29 received at 72300 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Ship Mints <shipmints <at> gmail.com>
Cc: 72300 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 Federico Tedin <federicotedin <at> gmx.de>
Subject: Re: bug#72300: project.el: detect newly created project contained
 within another
Date: Mon, 30 Sep 2024 04:50:38 +0300
On 13/08/2024 17:50, Ship Mints wrote:
> As some food for thought, we've used git attributes via "git check-attr" 
> to record custom metadata at the repository level to provide hints to 
> tooling. As project.el and other tools evolve, perhaps we can consider 
> the cases where users can supply functions that influence behavior where 
> one use case is based on things like git attributes. The case in hand is 
> whether a submodule should be considered external to a project.el 
> project such as the vendor/third-party submodule I'd mentioned. We use 
> the default project-vc-merge-submodules t and our exceptions could be 
> encoded via a custom git attribute and indicated via a predicate 
> function, perhaps. In the absence of formal guidelines, and git does not 
> seem to define "reserved words" for naming, we prefix custom attributes 
> with an underscore.

Git attributes is a possible approach, with a downside of extra process 
calls, which over Tramp (for example) would mean additional latency.

How about we just support filtering out submodules using the 
project-vc-ignores var? Which can be assigned in .dir-locals.el or 
through other means.

I kind of hoped this would work automatically, it does not, but adding 
the extra comparisons against the list of ignores seems natural enough.

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 599a350e5ce..79fcfb65f87 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -720,7 +731,9 @@ project--vc-list-files
          (let ((sub-files
                 (mapcar
                  (lambda (module)
-                   (when (file-directory-p module)
+                   (when (and (file-directory-p module)
+                              ;; TODO: Support real globs.
+                              (not (member module extra-ignores)))
                      (let ((sub-files
                             (project--vc-list-files
                              (concat default-directory module)





This bug report was last modified 264 days ago.

Previous Next


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