bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59722: 30.0.50; project-find-regexp searches project-ignored files


From: Rudolf Adamkovič
Subject: bug#59722: 30.0.50; project-find-regexp searches project-ignored files
Date: Mon, 05 Dec 2022 00:36:34 +0100

Dmitry Gutov <dgutov@yandex.ru> writes:

> Okay.

Thank you for your time, Dmitry!

> I wonder how that could be possible: project-find-regexp (that if what
> you have 'C-x p g' bound to, right?) does the search across the files
> returned by 'project-files'. So there is just one place that
> interprets the ignores' list and produces the list of files, and both
> project-find-file and project-find-regexp consume the result.

I provide a hypothesis about how that could happen below.

> Can you step through 'project-find-regexp' with edebug? Does the
> return value of 'project-files' (saved to 'files') contain the extra
> entries?

So, I debugged the problem.

FINDING 1:

The first finding may explain why I see the ignored files in C-x p g.

For my dir-local ignore pattern

  ((nil . ((project-ignores . ("apps/**/*.scm")))))

Emacs ends up calling

  git ls-files -z -c --exclude-standard \
    --no-empty-directory -o -- :(exclude,glob,top)apps/**/*.scm

which gives a listing that DOES NOT contain (as expected) any '*.scm'
files in the 'apps' directory, such as

  apps/lib-app-core/src/main/assets/app/atrium.scm
  apps/lib-app-core/src/main/assets/app/database.scm
  ...

but it still DOES contain "logically empty" parent directories (as not
expected, perhaps) that would have contained the ignored files if not
ignored, such as

  apps/lib-app-core/src/main/assets/app

My interpretation:

git ls-files does not output just files, as one would expect, but also
directories with no matching files.  grep then gets a list of files and
possibly also directories, and searches through it all.

FINDING 2:

Given the configuration

  (setq project-switch-use-entire-map t
        project-switch-commands '((nil "C-x p")))

when I type

  C-x p p <...project...> g

then Emacs uses the global project ignores and not the ones defined in
the directory-local file.  However,

  C-x p g

inside of any project buffer works OK.

Notes:

While probably not the root cause, this bug made debugging much harder,
until I realized it exists, so I report this finding as well.

Rudy
-- 
"One can begin to reason only when a clear picture has been formed in
the imagination."
-- Walter Warwick Sawyer, Mathematician's Delight, 1943

Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia





reply via email to

[Prev in Thread] Current Thread [Next in Thread]