GNU bug report logs -
#65704
29.1; Most code of `project-ignores' seems to be dead code
Previous Next
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
Message #16 received at 65704 <at> debbugs.gnu.org (full text, mbox):
Dmitry Gutov <dgutov <at> yandex.ru> writes:
> much. Maybe just that that code path isn't exercised by any in-tree
> function if the backend is Git (with recent enough git installed)
My Git repository has several .gitignore files in several directories,
something that `project-ignores' (for VC) seems to not support:
;; we only support .gitignore at the root.
My project looks like this:
.
├── client
│ ├── .gitignore
│ ├── node_modules
│ └── .project
├── .git
└── .gitignore
Because I spend most of my time in the client/ directory, I want the
`project' library to consider client/ to be a project on its own. I use
the code below and the client/.project file to do this:
(defconst my/project-root-marker ".project"
"File indicating the root of a project.")
(defun my/project-find-root (path)
"Search up the PATH for `my/project-root-marker'."
(when-let* ((root (locate-dominating-file path my/project-root-marker)))
(cons 'transient root)))
(add-to-list 'project-find-functions #'my/project-find-root)
The client/.gitignore file contains a line "node_modules/" which is a
very large directory. The command `project-find-file' doesn't see my
client/.gitignore and thus suggests 83k files and make the completion UI
very slow. So I'm not using it but this instead:
(project-find-file-in (thing-at-point 'filename)
(list "/my/project/client")
(project-current nil "/my/project"))
The function `project-find-file-in' uses `project-files' which in turn
uses `project--dir-ignores'. The later uses `project-ignores' which has
the bug mentioned in this issue.
Am I doing something reasonable? Is there a better way? It looks like a
lot of setup to get Emacs to ignore directories listed .gitignore files.
--
Damien Cassou
"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill
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.