all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Dmitry Gutov <dgutov@yandex.ru>, 59722@debbugs.gnu.org
Subject: bug#59722: 30.0.50; project-find-regexp searches project-ignored files
Date: Mon, 05 Dec 2022 00:36:34 +0100	[thread overview]
Message-ID: <m24juawxkt.fsf@me.com> (raw)
In-Reply-To: <1f6b991a-d67e-5e38-b77f-038e97218e4e@yandex.ru>

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	other threads:[~2022-12-04 23:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-30 14:35 bug#59722: 30.0.50; project-find-regexp searches project-ignored files Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-30 15:09 ` Dmitry Gutov
2022-11-30 23:20   ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-30 23:30     ` Dmitry Gutov
2022-12-04 23:36       ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-12-05  0:43         ` Dmitry Gutov
2022-12-09 16:21           ` Dmitry Gutov
2022-12-11 12:38           ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-11 20:13             ` Dmitry Gutov

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

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

  git send-email \
    --in-reply-to=m24juawxkt.fsf@me.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=59722@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=salutis@me.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.