From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jan =?UTF-8?Q?Syn=C3=A1=C4=8Dek?= Newsgroups: gmane.emacs.bugs Subject: bug#55632: [PATCH] Add new user option project-vc-find-tracked-only Date: Wed, 25 May 2022 09:08:54 +0000 Message-ID: <87leuqkmhl.fsf@posteo.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31355"; mail-complaints-to="usenet@ciao.gmane.io" To: 55632@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 25 16:13:48 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 1ntrlk-0007yr-8M for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 May 2022 16:13:48 +0200 Original-Received: from localhost ([::1]:35918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntrli-0007EP-FX for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 May 2022 10:13:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntrcJ-000399-Hz for bug-gnu-emacs@gnu.org; Wed, 25 May 2022 10:04:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34015) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntrcJ-000727-82 for bug-gnu-emacs@gnu.org; Wed, 25 May 2022 10:04:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ntrcJ-0008Ku-3o for bug-gnu-emacs@gnu.org; Wed, 25 May 2022 10:04:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jan =?UTF-8?Q?Syn=C3=A1=C4=8Dek?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 May 2022 14:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 55632 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.165348742131962 (code B ref -1); Wed, 25 May 2022 14:04:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 May 2022 14:03:41 +0000 Original-Received: from localhost ([127.0.0.1]:56137 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ntrbq-0008JG-A4 for submit@debbugs.gnu.org; Wed, 25 May 2022 10:03:41 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:39608) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ntn0x-0007q4-IY for submit@debbugs.gnu.org; Wed, 25 May 2022 05:09:15 -0400 Original-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 ) id 1ntn0r-0006d3-Jm for bug-gnu-emacs@gnu.org; Wed, 25 May 2022 05:09:11 -0400 Original-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 ) id 1ntn0l-0003xO-K4 for bug-gnu-emacs@gnu.org; Wed, 25 May 2022 05:09:05 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 972A0240108 for ; 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== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4L7QGv1FFnz9rxf for ; Wed, 25 May 2022 11:08:55 +0200 (CEST) Received-SPF: pass client-ip=185.67.36.66; envelope-from=jan.synacek@posteo.org; 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-Mailman-Approved-At: Wed, 25 May 2022 10:03:28 -0400 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:233064 Archived-At: --=-=-= 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?= 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 --=-=-=--