unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: jan.synacek@posteo.org
Cc: 55632@debbugs.gnu.org, DG <raaahh@gmail.com>
Subject: bug#55632: [PATCH] Add new user option project-vc-find-tracked-only
Date: Wed, 1 Jun 2022 01:57:42 +0300	[thread overview]
Message-ID: <fc5f5dc4-1822-fe94-27b9-5eecd0dae0ed@yandex.ru> (raw)
In-Reply-To: <dec620e6b37272e42aa892b322203a5e@posteo.de>

On 30.05.2022 13:08, jan.synacek@posteo.org wrote:
> On 27.05.2022 15:55, Dmitry Gutov wrote:
>> On 25.05.2022 12:08, Jan Synáček wrote:
>>> Currently, `project-find-file' always includes untracked files, which is
>>> not always the desired behavior. This patch adds a new user option to
>>> make only find the actual project files. By default, the variable is set
>>> to nil, which means the behavior is not changed.
>>
>> Sure, thanks. I'll review this soon-ish.
>>
>> As long as you are aware of the user option project-vc-ignores (which
>> can be set directory-locally), and are certain that it doesn't satisfy
>> your needs.
> 
> Short answer:
> Yes, I'm aware, but that option is something different. I don't want to 
> add anything to ignore.

That's cool.

> Long answer:
> This mostly applies to the git and mercurial Emacs backends where the 
> untracked files are
> used by default now. I think that presenting a "project" as pretty much 
> everything in a
> folder (unless selectively ignored by using project-vc-ignores, for 
> example)

^^^or included in .gitignore or .hgignore

> only makes
> sense if there is no underlying VCS, otherwise it's pretty much 
> backwards. Because if
> there's already a repo that tracks files, the project should be, in my 
> opinion, just the
> files in that repo that the underlying VCS sees as tracked. That is the 
> default behavior
> in git and mercurial as far as I know (I don't use mercurial much, but 
> use git a lot). The
> VCS also has a mechanism for including untracked files in case the user 
> wants to see them
> in some operations, and ignoring additional files so that they don't 
> count towards those
> untracked files. These two options should map 1 to 1 to Emacs custom 
> variables, in my
> opinion.
> So, in summary, I would suggest to change the VC backends that support 
> this to behave by
> default as the underlying VCS would behave and use custom variables to 
> add additional
> tweaks for non-default stuff. Of course, that is out of scope for this 
> patch.

Here's the reasoning I used:

- Almost everyone works with a VCS. Let's use Git in this example.
- You start working on a new feature to your project. You add a couple 
of new source files, write tests for them. Haven't checked them in yet.
- To switch between the project files you probably use 
'project-find-file'. You are likely to use that function (or 
'project-find-regexp'), etc, during the initial phase of developing a 
new feature as well, and to jump between the newly created files, and 
their tests, etc.
- That creates expectation that new files should be considered part of 
the project. And overall, false positive is usually better for this kind 
of thing than false negative (not finding something that you expect to 
be there).

Using .xyzignore files to list files that are junk/unimportant/etc is 
par for the course when using a VCS. Until a file is added there (or 
checked in), it's very visible in 'git status'. Having them omitted from 
the list of project files would make them much less "visible", 
contradicting Git's (or Mercurial or etc) behavior.





  reply	other threads:[~2022-05-31 22:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-25  9:08 bug#55632: [PATCH] Add new user option project-vc-find-tracked-only Jan Synáček
2022-05-27 11:01 ` Lars Ingebrigtsen
2022-05-27 13:55 ` Dmitry Gutov
2022-05-29 21:41   ` Dmitry Gutov
2022-05-30 11:00     ` jan.synacek
2022-05-31 22:49       ` Dmitry Gutov
2022-06-02 19:01         ` jan.synacek
2022-06-02 19:19           ` Eli Zaretskii
2022-06-02 23:45             ` Dmitry Gutov
2022-06-03  5:44               ` Eli Zaretskii
2022-06-04  0:37                 ` Dmitry Gutov
2022-06-04  6:29                   ` Eli Zaretskii
2022-06-04  9:40                     ` Dmitry Gutov
2022-05-30 10:08   ` jan.synacek
2022-05-31 22:57     ` Dmitry Gutov [this message]
2022-06-01 15:21       ` jan.synacek

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=fc5f5dc4-1822-fe94-27b9-5eecd0dae0ed@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=55632@debbugs.gnu.org \
    --cc=jan.synacek@posteo.org \
    --cc=raaahh@gmail.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 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).