GNU bug report logs - #55632
[PATCH] Add new user option project-vc-find-tracked-only

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Jan Synáček <jan.synacek@HIDDEN>; Keywords: patch; dated Wed, 25 May 2022 14:04:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 55632 <at> debbugs.gnu.org:


Received: (at 55632) by debbugs.gnu.org; 27 May 2022 11:01:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 27 07:01:37 2022
Received: from localhost ([127.0.0.1]:32899 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nuXir-0000cO-57
	for submit <at> debbugs.gnu.org; Fri, 27 May 2022 07:01:37 -0400
Received: from quimby.gnus.org ([95.216.78.240]:39346)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1nuXip-0000c9-G2
 for 55632 <at> debbugs.gnu.org; Fri, 27 May 2022 07:01:36 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID
 :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
 List-Post:List-Owner:List-Archive;
 bh=6kVKTlTTcUghg2oXu0HbPpWa0jZxnoLmIKGoPUj0HSk=; b=NBngdWFipm81O9v4zrOKx2ikGg
 3LKR7O/iq6932BRfDc5IowjjgR70O0i4F3Is/kpTSf/XPfsr5h61p2iDZPdpxvSRM6+ffjTdR4tbW
 5xZYDybhfMRMfdMPcQ0l4SQDkq+gO4chNlOTQbmqt+ZxMjgApMoQJuJc1zRDQN0CIMu0=;
Received: from [84.212.220.105] (helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1nuXig-0007AT-RX; Fri, 27 May 2022 13:01:29 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Jan =?utf-8?B?U3luw6HEjWVr?= <jan.synacek@HIDDEN>
Subject: Re: bug#55632: [PATCH] Add new user option
 project-vc-find-tracked-only
References: <87leuqkmhl.fsf@HIDDEN>
X-Now-Playing: Cris Williamson's _The Changer and the Changed_: "Wild Things"
Date: Fri, 27 May 2022 13:01:26 +0200
In-Reply-To: <87leuqkmhl.fsf@HIDDEN> ("Jan =?utf-8?B?U3luw6HEjWVrIidz?=
 message of "Wed, 25 May 2022 09:08:54 +0000")
Message-ID: <87pmjz6xyx.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 
 Content preview:  Jan Synáček <jan.synacek@HIDDEN> writes: > 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 [...] 
 
 Content analysis details:   (-2.9 points, 5.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
                             [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 55632
Cc: 55632 <at> debbugs.gnu.org, Dmitry Gutov <dgutov@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Jan Syn=C3=A1=C4=8Dek <jan.synacek@HIDDEN> writes:

> 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.

Makes sense to me, but perhaps Dmitry has some comments here -- added to
the CCs.

--=20
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#55632; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 25 May 2022 14:03:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 25 10:03:41 2022
Received: from localhost ([127.0.0.1]:56137 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ntrbq-0008JG-A4
	for submit <at> debbugs.gnu.org; Wed, 25 May 2022 10:03:41 -0400
Received: from lists.gnu.org ([209.51.188.17]:39608)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jan.synacek@HIDDEN>) id 1ntn0x-0007q4-IY
 for submit <at> debbugs.gnu.org; Wed, 25 May 2022 05:09:15 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:59448)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <jan.synacek@HIDDEN>)
 id 1ntn0r-0006d3-Jm
 for bug-gnu-emacs@HIDDEN; Wed, 25 May 2022 05:09:11 -0400
Received: from mout02.posteo.de ([185.67.36.66]:34267)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <jan.synacek@HIDDEN>)
 id 1ntn0l-0003xO-K4
 for bug-gnu-emacs@HIDDEN; Wed, 25 May 2022 05:09:05 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 972A0240108
 for <bug-gnu-emacs@HIDDEN>; Wed, 25 May 2022 11:08:55 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.org; s=2017;
 t=1653469735; bh=7g7HUXBamKt6yrtTWT2ch2vPVqSFTyX0LK3OHi8HAHc=;
 h=From:To:Subject:Date:From;
 b=NeCRvKywCt1hOgpBAIzPhcl0R65EVPPfMtlN4bgpyMnh7pPviJdjiItTvRJ528uYd
 7+cD7nQZvsLSdxeiJgOzyNqgK93oOEmBKepbbDjEvxSHl8spjLO8CqAHb3rd1MF4Hn
 2Lf7JsNKJQf2RZ5cHQD+p3abyy+zNMk0beN6YTc0xRKBYrMN/4Bu+aVkLsGtzYCon+
 hm9WwDbWCFfaZSqSE38MVERS8eHi4EPq5ZxMJXTFm+eEO4zM08FxpMAN/ZZj13jlvt
 J1U+hIONze39XinKg5FrK8XT1g1HDkC3NK0uuHVXF4bJMDQ3lulFIRm9IRtVgjdIFq
 kKl3jh/zIR38w==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4L7QGv1FFnz9rxf
 for <bug-gnu-emacs@HIDDEN>; Wed, 25 May 2022 11:08:55 +0200 (CEST)
From: =?utf-8?B?SmFuIFN5bsOhxI1law==?= <jan.synacek@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Add new user option project-vc-find-tracked-only
Date: Wed, 25 May 2022 09:08:54 +0000
Message-ID: <87leuqkmhl.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=185.67.36.66; envelope-from=jan.synacek@HIDDEN;
 helo=mout02.posteo.de
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Wed, 25 May 2022 10:03:28 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: text/plain

Tags: patch

Tags: patch


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.

In GNU Emacs 28.1.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.17.6)
 of 2022-05-21 built on jsynacek-home
Repository revision: 9e7c0cf57d522b50423880f3a846c52c5509fef9
Repository branch: emacs-28
Windowing system distributor 'The X.Org Foundation', version 11.0.12101003
System Description: Arch Linux

Configured using:
 'configure --with-imagemagick --with-json --with-native-compilation
 --prefix=/home/jsynacek/emacs'


--=-=-=
Content-Type: text/patch
Content-Disposition: attachment;
 filename=0001-Add-new-user-option-project-vc-find-tracked-only.patch

From e1562448ca0d95188c4dc9712c8aa4575a5a3bdd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Syn=C3=A1=C4=8Dek?= <jan.synacek@HIDDEN>
Date: Wed, 25 May 2022 10:53:55 +0200
Subject: [PATCH] Add new user option project-vc-find-tracked-only

* doc/emacs/maintaining.texi (Projects): Document it.
* lisp/progmodes/project.el (project--vc-list-files): Use it.
---
 doc/emacs/maintaining.texi |  6 ++++--
 etc/NEWS                   |  5 +++++
 lisp/progmodes/project.el  | 16 +++++++++++-----
 3 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index 3ddea0ae58..c33b649490 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -1664,8 +1664,10 @@ Projects
 support additional types of projects.
 
   Which files do or don't belong to a project is also determined by
-the project back-end.  For example, the VC back-end doesn't consider
-``ignored'' files (@pxref{VC Ignore}) to be part of the project.
+the project back-end.  For example, the VC back-end only considers
+``ignored'' files (@pxref{VC Ignore}) to be part of the project if
+the value of the variable @code{project-vc-find-tracked-only} is
+non-nil.
 
 @menu
 * Project File Commands::   Commands for handling project files.
diff --git a/etc/NEWS b/etc/NEWS
index 857f300384..abae05749c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1678,6 +1678,11 @@ Enabling this minor mode turns on hiding header material, like
 'elide-head' does; disabling it shows the header.  The commands
 'elide-head' and 'elide-head-show' are now obsolete.
 
++++
+*** New user option 'project-vc-find-tracked-only'.
+If set to non-nil, 'project-find-file' only considers tracked, that is
+not ignored, files.
+
 ---
 ** The autoarg.el library is now marked obsolete.
 This library provides the 'autoarg-mode' and 'autoarg-kp-mode' minor
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 6c50135358..836d6a1574 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -382,6 +382,11 @@ project-vc-merge-submodules
   :package-version '(project . "0.2.0")
   :safe #'booleanp)
 
+(defcustom project-vc-find-tracked-only nil
+  "Non-nil makes `project-find-file' consider only tracked files."
+  :type 'boolean
+  :safe #'booleanp)
+
 ;; FIXME: Using the current approach, major modes are supposed to set
 ;; this variable to a buffer-local value.  So we don't have access to
 ;; the "external roots" of language A from buffers of language B, which
@@ -512,8 +517,9 @@ project--vc-list-files
            (args '("-z"))
            (vc-git-use-literal-pathspecs nil)
            files)
-       ;; Include unregistered.
-       (setq args (append args '("-c" "-o" "--exclude-standard")))
+       (setq args (append args
+                          '("-c" "--exclude-standard")
+                          (unless project-vc-find-tracked-only '("-o"))))
        (when extra-ignores
          (setq args (append args
                             (cons "--"
@@ -565,9 +571,9 @@ project--vc-list-files
        (delete-consecutive-dups files)))
     (`Hg
      (let ((default-directory (expand-file-name (file-name-as-directory dir)))
-           args)
-       ;; Include unregistered.
-       (setq args (nconc args '("-mcardu" "--no-status" "-0")))
+           (args (list (concat "-mcard" (unless project-vc-find-tracked-only "u"))
+                       "--no-status"
+                       "-0")))
        (when extra-ignores
          (setq args (nconc args
                            (mapcan
-- 
2.36.1


--=-=-=--




Acknowledgement sent to Jan Synáček <jan.synacek@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#55632; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 27 May 2022 11:15:01 UTC

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