unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Damien Cassou <damien@cassou.me>
To: Dmitry Gutov <dgutov@yandex.ru>, 65704@debbugs.gnu.org
Subject: bug#65704: 29.1; Most code of `project-ignores' seems to be dead code
Date: Mon, 04 Sep 2023 18:03:04 +0200	[thread overview]
Message-ID: <874jkakjt3.fsf@cassou.me> (raw)
In-Reply-To: <ed33c2c7-d049-e807-d629-ba87eb0ce32c@yandex.ru>

Dmitry Gutov <dgutov@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





  reply	other threads:[~2023-09-04 16:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-02 16:03 bug#65704: 29.1; Most code of `project-ignores' seems to be dead code Damien Cassou
2023-09-02 16:17 ` bug#65704: [PATCH] project.el: Fix bug in project-ignores Damien Cassou
2023-09-03  0:26 ` bug#65704: 29.1; Most code of `project-ignores' seems to be dead code Dmitry Gutov
2023-09-04 16:03   ` Damien Cassou [this message]
2023-09-04 18:30     ` Dmitry Gutov
2023-09-04 20:11       ` Damien Cassou
2023-09-04 20:17         ` Dmitry Gutov
2023-09-05  7:58           ` Damien Cassou
2023-09-05 14:09             ` Dmitry Gutov
2023-09-05 20:22               ` Damien Cassou
2023-09-06 19:12               ` Damien Cassou
2023-09-06 21:16                 ` Dmitry Gutov
2023-09-04 18:31   ` Dmitry Gutov
2023-09-04 18:48     ` Eli Zaretskii
2023-09-04 18:58       ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874jkakjt3.fsf@cassou.me \
    --to=damien@cassou.me \
    --cc=65704@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).