From: jan.synacek@posteo.org
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 55632@debbugs.gnu.org, DG <raaahh@gmail.com>
Subject: bug#55632: [PATCH] Add new user option project-vc-find-tracked-only
Date: Mon, 30 May 2022 11:00:07 +0000 [thread overview]
Message-ID: <43b5eada954e592cc0c747368a3dbdb7@posteo.de> (raw)
In-Reply-To: <b98f1e4b-c04d-43ef-584d-194d691d8c0d@yandex.ru>
[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]
On 29.05.2022 23:41, Dmitry Gutov wrote:
> On 27.05.2022 16: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.
>
> The patch seems functional, thanks. Should also get you better
> performance, if this is the behavior you prefer.
>
> Regarding the naming and the docstring, though: unlike what the
> defcustom says, it will affect also 'project-find-regexp' (i.e. which
> files get searched by this command), and all other features that
> delegate to 'project-files' internally.
>
> So the docstring could use some generalizing. And consider these two
> options for rename:
>
> - project-vc-tracked-only (defaulting to nil, like in the patch)
> - project-vc-include-untracked (defaulting to t)
>
> The docstring could say something like:
>
> When non-nil, the VC project backend includes the untracked files.
Thank you for the review. I addressed your comments in the new version
of the patch.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-new-user-option-project-vc-include-untracked.patch --]
[-- Type: text/x-patch; name=0001-Add-new-user-option-project-vc-include-untracked.patch, Size: 3437 bytes --]
From be368647783da8c12e2ea175401dd7f84d0cd4c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Syn=C3=A1=C4=8Dek?= <jan.synacek@gmail.com>
Date: Wed, 25 May 2022 10:53:55 +0200
Subject: [PATCH] Add new user option project-vc-include-untracked
* doc/emacs/maintaining.texi (Projects): Document it.
* lisp/progmodes/project.el (project--vc-list-files): Use it.
---
doc/emacs/maintaining.texi | 3 +++
etc/NEWS | 4 ++++
lisp/progmodes/project.el | 16 +++++++++++-----
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index 3ddea0ae58..6f0da63837 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -1666,6 +1666,9 @@ 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.
+Also, some VC back-ends consider ``untracked'' files by default.
+That behavior is controllable with the variable
+@code{project-vc-include-untracked}.
@menu
* Project File Commands:: Commands for handling project files.
diff --git a/etc/NEWS b/etc/NEWS
index 5987acdac9..b695d63020 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1693,6 +1693,10 @@ 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-include-untracked'.
+When non-nil, the VC project backend includes the untracked 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..e488fa145e 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-include-untracked t
+ "When non-nil, the VC project backend includes the untracked 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")
+ (when project-vc-include-untracked '("-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" (when project-vc-include-untracked "u"))
+ "--no-status"
+ "-0")))
(when extra-ignores
(setq args (nconc args
(mapcan
--
2.36.1
next prev parent reply other threads:[~2022-05-30 11:00 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 [this message]
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
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=43b5eada954e592cc0c747368a3dbdb7@posteo.de \
--to=jan.synacek@posteo.org \
--cc=55632@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
--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).