GNU bug report logs - #41736
28.0.50; project.el - support global patterns for project-ignores

Previous Next

Package: emacs;

Reported by: Theodor Thornhill <theo <at> thornhill.no>

Date: Sat, 6 Jun 2020 09:46:02 UTC

Severity: normal

Found in version 28.0.50

To reply to this bug, email your comments to 41736 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#41736; Package emacs. (Sat, 06 Jun 2020 09:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Theodor Thornhill <theo <at> thornhill.no>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 06 Jun 2020 09:46:02 GMT) Full text and rfc822 format available.

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

From: Theodor Thornhill <theo <at> thornhill.no>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; project.el - support global patterns for project-ignores
Date: Sat, 06 Jun 2020 09:45:42 +0000
Hello,

In https://debbugs.gnu.org/cgi/bugreport.cgi?bug=41572 there is talk about supporting a "plain project", and when joining that chat I realised that the "best" current implementation is the VC backend. However, this backend does not easily include other patterns to ignore.

For example we might want to ignore "node_modules", "elm-stuff" etc.
These can be added pretty easily to 'project-vc-ignores' via:

1. Major mode support: "(setq-local project-vc-ignores '("foo" "bar"))"
2. User init.el "(add-to-list project-vc-ignores "foo")"

However, there are some drawbacks.
Method 1:
- We rely on major mode to implement this
- When using "project-switch-project", then press "f - find-file" the ignore is not recognized yet since it relies on the major mode.
- It does not work when a project uses several modes

Method 2:
- Needs user to add this to own init file.
- Pollutes the defcustom globally

Is there a way to set these patters such that we still can use the fast VC backend, but not have these drawbacks?

It seems like an easy solution could be to add a "defcustom project-ignore-patterns" that the project-vc backend picks up. This could be set by both future major modes and as user customization.

FWIW, method 2 seems to work perfectly, yet seems like kind of a hack.

Theo






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41736; Package emacs. (Sat, 06 Jun 2020 09:55:01 GMT) Full text and rfc822 format available.

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

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Theodor Thornhill <theo <at> thornhill.no>
Cc: 41736 <at> debbugs.gnu.org
Subject: Re: bug#41736: 28.0.50; project.el - support global patterns for
 project-ignores
Date: Sat, 06 Jun 2020 10:53:54 +0100
Theodor Thornhill <theo <at> thornhill.no> writes:

> It seems like an easy solution could be to add a "defcustom
> project-ignore-patterns" that the project-vc backend picks up. This could be set
> by both future major modes and as user customization.

Note that defcustoms are generally a user-level preference and should
therefore generally not be modified by major modes or other Lisp.

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41736; Package emacs. (Sat, 06 Jun 2020 10:12:01 GMT) Full text and rfc822 format available.

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

From: Theodor Thornhill <theo <at> thornhill.no>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 41736 <at> debbugs.gnu.org
Subject: Re: bug#41736: 28.0.50;
 project.el - support global patterns for project-ignores
Date: Sat, 06 Jun 2020 10:10:59 +0000
[Message part 1 (text/plain, inline)]
On Sat, Jun 6, 2020 at 11:53, Basil L. Contovounesios <contovob <at> tcd.ie> wrote:

> Note that defcustoms are generally a user-level preference and should
> therefore generally not be modified by major modes or other Lisp.

> Yeah, absolutely. Unclear wording from my end.

What I mean is:

We seem to want the vc backend no matter what. However - if I open dired in root and execute “project-find-files” all the stuff I want ignored is not. I get the fast backend, but may search a million obfuscated minified files.

I think what I want is to be able to say:
1. Use the vc backed “major-mode” project
2. Use the vc backed “major-modes” project

Not sure how this would be implemented most clearly, but maybe the “project-vc-ignores” defcustom in init.el is the magic wand here?

If so - this bug report could be reduced to “add documentation to clarify this” :)

Theo
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41736; Package emacs. (Sat, 06 Jun 2020 11:09:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Theodor Thornhill <theo <at> thornhill.no>, 41736 <at> debbugs.gnu.org
Subject: Re: bug#41736: 28.0.50; project.el - support global patterns for
 project-ignores
Date: Sat, 6 Jun 2020 14:08:41 +0300
On 06.06.2020 12:45, Theodor Thornhill wrote:
> Hello,
> 
> In https://debbugs.gnu.org/cgi/bugreport.cgi?bug=41572 there is talk about supporting a "plain project", and when joining that chat I realised that the "best" current implementation is the VC backend. However, this backend does not easily include other patterns to ignore.
> 
> For example we might want to ignore "node_modules", "elm-stuff" etc.
> These can be added pretty easily to 'project-vc-ignores' via:
> 
> 1. Major mode support: "(setq-local project-vc-ignores '("foo" "bar"))"

I'm not sure major modes are the place to do this: after all, the user 
can call project-find-files while visiting a file in some other mode 
(say, README.md). The view of the list of project files should remain 
consistent.

> 2. User init.el "(add-to-list project-vc-ignores "foo")"
> 
> However, there are some drawbacks.
> Method 1:
> - We rely on major mode to implement this
> - When using "project-switch-project", then press "f - find-file" the ignore is not recognized yet since it relies on the major mode.

Indeed.

> - It does not work when a project uses several modes

And I think it's the common case.

> Method 2:
> - Needs user to add this to own init file.
> - Pollutes the defcustom globally
> 
> Is there a way to set these patters such that we still can use the fast VC backend, but not have these drawbacks?

How about .dir-locals.el?

project--value-in-dir takes particular care to read these files.

> It seems like an easy solution could be to add a "defcustom project-ignore-patterns" that the project-vc backend picks up. This could be set by both future major modes and as user customization.

This also either pollutes user's init.el or remains major mode specific, 
right?




This bug report was last modified 3 years and 323 days ago.

Previous Next


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