From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#55632: [PATCH] Add new user option project-vc-find-tracked-only Date: Wed, 1 Jun 2022 01:57:42 +0300 Message-ID: References: <87leuqkmhl.fsf@posteo.org> <9e283838-aaa1-345e-bce8-21ee863dbc31@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17315"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Cc: 55632@debbugs.gnu.org, DG To: jan.synacek@posteo.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 01 00:58:23 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nwAoh-0004Jf-2t for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 01 Jun 2022 00:58:23 +0200 Original-Received: from localhost ([::1]:39088 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwAof-0002Mq-Do for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 31 May 2022 18:58:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwAoN-0002Ma-8j for bug-gnu-emacs@gnu.org; Tue, 31 May 2022 18:58:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55212) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwAoM-0006S0-J8 for bug-gnu-emacs@gnu.org; Tue, 31 May 2022 18:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nwAoM-0005L5-Ft for bug-gnu-emacs@gnu.org; Tue, 31 May 2022 18:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 31 May 2022 22:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55632 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 55632-submit@debbugs.gnu.org id=B55632.165403787520506 (code B ref 55632); Tue, 31 May 2022 22:58:02 +0000 Original-Received: (at 55632) by debbugs.gnu.org; 31 May 2022 22:57:55 +0000 Original-Received: from localhost ([127.0.0.1]:49109 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nwAoF-0005Kg-9R for submit@debbugs.gnu.org; Tue, 31 May 2022 18:57:55 -0400 Original-Received: from mail-ed1-f41.google.com ([209.85.208.41]:35476) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nwAoA-0005KH-KG for 55632@debbugs.gnu.org; Tue, 31 May 2022 18:57:54 -0400 Original-Received: by mail-ed1-f41.google.com with SMTP id t5so19470247edc.2 for <55632@debbugs.gnu.org>; Tue, 31 May 2022 15:57:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=vdtnPN/j4kPDWrwCYA1eyoiwDQjQxi26c50sJZR78Xc=; b=oeoyAgfPJFkYuZCyA3NtagldmeOk0SJYdZJGLm7SeMF0P2mltVLxZl8411XYL1ITVb RlbCOq5ymOjgFpvEC4wD6pLVOLUeuXfS0Xpe8szmH1LZV5XIkh+tNkuowhXTSLCDvZ8/ lscKrElaXUoQ+Q1pUTZjz2Fe0XqCR/9viNGuhK3orSwkxoACKfeg0D4p4x1jC4/H892G EQiAI7fLo4aeqZRoqCPQ8eNjT5AmWotcIQE1Xq0qgH17qc2xcuCgpGbdsEr+siht5NI0 NQleJ57oS6ikS1Qem0sgszTlvqwLplJPcL98FXzL+EcmEIq5+PYQZRJ5+vI/kHAB7ksL l6qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=vdtnPN/j4kPDWrwCYA1eyoiwDQjQxi26c50sJZR78Xc=; b=4IINmImNzEWH8LN5K4PB6/crhEq560kbgRD+OAmj+Kb6ltEj3f2vhn8gEtDBFkR3Qt R/weL5Ae/HVEeES792CIKBTErvbcqvF0Qs3wtiel4b2swMfwwZNwm0I5gauLLbYt0slM U8wD+yf7YLNOObhT4Lx6FnGEaoKXJRnYxU4qUUSEjMI/LejthXP9u9lNOTWW+dXvCfgz QPqD/xAJwnxU8az9JzkqalWJdRLr68Sz6lZNBVeQoUqNuj2vvtBHyPeNtesNwCbtSznL UPfkbeyk2Mqy4/aiIQUDD7HamkFu5fr+8wBi0/hR3G4da1Wxq3A17AlGrnZiZXWCQIm2 lCrg== X-Gm-Message-State: AOAM533GRXDQc1UWIIr4kkjnKWoaJEJGXnddrvHjAwm1OPH0u1H59Cn/ vZVLqzwd2fmS7G/78YaWyqE= X-Google-Smtp-Source: ABdhPJw4DTbdTmEmK75Lc57FHhAFvodxzeodHvokrJNOMeVjk5AgFYdfNbBhqDbz0XCd0NVELjrI7A== X-Received: by 2002:a05:6402:28a2:b0:42d:e116:de8f with SMTP id eg34-20020a05640228a200b0042de116de8fmr6771629edb.305.1654037864443; Tue, 31 May 2022 15:57:44 -0700 (PDT) Original-Received: from [192.168.236.48] ([173.237.64.48]) by smtp.googlemail.com with ESMTPSA id a11-20020a056402236b00b0042dd4ccccf5sm3897491eda.82.2022.05.31.15.57.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 31 May 2022 15:57:43 -0700 (PDT) Content-Language: en-US In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:233468 Archived-At: 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.