* bug#75336: [PATCH] Allow pcomplete of git add to include untracked files.
@ 2025-01-04 0:00 Peter Seibel
2025-01-04 7:52 ` Eli Zaretskii
2025-01-04 7:54 ` Eli Zaretskii
0 siblings, 2 replies; 11+ messages in thread
From: Peter Seibel @ 2025-01-04 0:00 UTC (permalink / raw)
To: 75336
[-- Attachment #1.1: Type: text/plain, Size: 482 bytes --]
I was going a bit crazy trying to figure out why tab completion in *shell*
wasn't working for git add when I was trying to add a new file to my repo.
Turns out pcomplete was only completing modified tracked files.This patch
changes it so after git add it also completes untracked non-ignored files.
I believe I long ago signed a Copyright assignment to the Emacs project but
I'm happy to do it again if that's still required. Cheers!
--
Peter Seibel
http://www.gigamonkeys.com/
[-- Attachment #1.2: Type: text/html, Size: 764 bytes --]
[-- Attachment #2: 0001-Allow-pcomplete-of-git-add-to-include-untracked-file.patch --]
[-- Type: application/octet-stream, Size: 1581 bytes --]
From 7890a230953c081d93c806c8a802aa69452d7e28 Mon Sep 17 00:00:00 2001
From: Peter Seibel <peter@gigamonkeys.com>
Date: Fri, 3 Jan 2025 15:56:01 -0800
Subject: [PATCH] Allow pcomplete of git add to include untracked files.
---
lisp/pcmpl-git.el | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/lisp/pcmpl-git.el b/lisp/pcmpl-git.el
index f57c2d5470a..498918ac1c4 100644
--- a/lisp/pcmpl-git.el
+++ b/lisp/pcmpl-git.el
@@ -82,8 +82,18 @@ Files listed by `git ls-files ARGS' satisfy the predicate."
(pcomplete-from-help `(,vc-git-program "help" ,subcmd)
:argument
"-+\\(?:\\[no-\\]\\)?[a-z-]+=?"))))
+ ;; Complete modified tracked files and untracked files
+ ("add"
+ (pcomplete-here
+ (pcomplete-entries
+ nil (let ((modified (pcmpl-git--tracked-file-predicate "-m"))
+ (untracked (pcmpl-git--tracked-file-predicate "-o" "--exclude-standard")))
+ (lambda (file)
+ (or
+ (and modified (funcall modified file))
+ (and untracked (funcall untracked file))))))))
;; Complete modified tracked files
- ((or "add" "commit" "restore")
+ ((or "commit" "restore")
(pcomplete-here
(pcomplete-entries
nil (pcmpl-git--tracked-file-predicate "-m"))))
--
2.47.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* bug#75336: [PATCH] Allow pcomplete of git add to include untracked files.
2025-01-04 0:00 bug#75336: [PATCH] Allow pcomplete of git add to include untracked files Peter Seibel
@ 2025-01-04 7:52 ` Eli Zaretskii
2025-01-04 7:54 ` Eli Zaretskii
1 sibling, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2025-01-04 7:52 UTC (permalink / raw)
To: Peter Seibel; +Cc: 75336
> From: Peter Seibel <peter@gigamonkeys.com>
> Date: Fri, 3 Jan 2025 16:00:27 -0800
>
> I believe I long ago signed a Copyright assignment to the Emacs project but I'm happy to do it again if that's
> still required. Cheers!
Form sent off-list.
Thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#75336: [PATCH] Allow pcomplete of git add to include untracked files.
2025-01-04 0:00 bug#75336: [PATCH] Allow pcomplete of git add to include untracked files Peter Seibel
2025-01-04 7:52 ` Eli Zaretskii
@ 2025-01-04 7:54 ` Eli Zaretskii
2025-01-04 13:59 ` Peter Seibel
1 sibling, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2025-01-04 7:54 UTC (permalink / raw)
To: Peter Seibel, Augusto Stoffel; +Cc: Stefan Monnier, 75336
> From: Peter Seibel <peter@gigamonkeys.com>
> Date: Fri, 3 Jan 2025 16:00:27 -0800
>
> I was going a bit crazy trying to figure out why tab completion in *shell* wasn't working for git add when I was
> trying to add a new file to my repo. Turns out pcomplete was only completing modified tracked files.This
> patch changes it so after git add it also completes untracked non-ignored files.
Augusto and Stefan, any comments?
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#75336: [PATCH] Allow pcomplete of git add to include untracked files.
2025-01-04 7:54 ` Eli Zaretskii
@ 2025-01-04 13:59 ` Peter Seibel
2025-01-04 15:04 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 11+ messages in thread
From: Peter Seibel @ 2025-01-04 13:59 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Augusto Stoffel, Stefan Monnier, 75336
[-- Attachment #1.1: Type: text/plain, Size: 658 bytes --]
I just realized there's a better way to do this. New patch attached.
On Fri, Jan 3, 2025 at 11:54 PM Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Peter Seibel <peter@gigamonkeys.com>
> > Date: Fri, 3 Jan 2025 16:00:27 -0800
> >
> > I was going a bit crazy trying to figure out why tab completion in
> *shell* wasn't working for git add when I was
> > trying to add a new file to my repo. Turns out pcomplete was only
> completing modified tracked files.This
> > patch changes it so after git add it also completes untracked
> non-ignored files.
>
> Augusto and Stefan, any comments?
>
--
Peter Seibel
http://www.gigamonkeys.com/
[-- Attachment #1.2: Type: text/html, Size: 1232 bytes --]
[-- Attachment #2: 0002-Simpler-way-to-get-list-of-addable-files.patch --]
[-- Type: application/octet-stream, Size: 1236 bytes --]
From ac98fdd494e7d025ae47cf45424d9cdaeef7f104 Mon Sep 17 00:00:00 2001
From: Peter Seibel <peter@gigamonkeys.com>
Date: Sat, 4 Jan 2025 05:54:31 -0800
Subject: [PATCH 2/2] Simpler way to get list of addable files.
---
lisp/pcmpl-git.el | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/lisp/pcmpl-git.el b/lisp/pcmpl-git.el
index 498918ac1c4..ab5e3305865 100644
--- a/lisp/pcmpl-git.el
+++ b/lisp/pcmpl-git.el
@@ -86,12 +86,7 @@ Files listed by `git ls-files ARGS' satisfy the predicate."
("add"
(pcomplete-here
(pcomplete-entries
- nil (let ((modified (pcmpl-git--tracked-file-predicate "-m"))
- (untracked (pcmpl-git--tracked-file-predicate "-o" "--exclude-standard")))
- (lambda (file)
- (or
- (and modified (funcall modified file))
- (and untracked (funcall untracked file))))))))
+ nil (pcmpl-git--tracked-file-predicate "-o" "--exclude-standard" "-m"))))
;; Complete modified tracked files
((or "commit" "restore")
(pcomplete-here
--
2.47.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* bug#75336: [PATCH] Allow pcomplete of git add to include untracked files.
2025-01-04 13:59 ` Peter Seibel
@ 2025-01-04 15:04 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-04 15:52 ` Peter Seibel
0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2025-01-04 15:04 UTC (permalink / raw)
To: Peter Seibel; +Cc: Eli Zaretskii, Augusto Stoffel, 75336
>> > I was going a bit crazy trying to figure out why tab completion in
>> > *shell* wasn't working for git add when I was trying to add a new
>> > file to my repo. Turns out pcomplete was only completing modified
>> > tracked files. This patch changes it so after git add it also
>> > completes untracked non-ignored files.
>> Augusto and Stefan, any comments?
The (new) patch looks good to me.
FWIW, it also makes sense occasionally to `git add` ignored files
(e.g. we could want to track a `.elc` file in the test suite inside the
Emacs repository to check how we handle specific old-format `.elc`
files).
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#75336: [PATCH] Allow pcomplete of git add to include untracked files.
2025-01-04 15:04 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2025-01-04 15:52 ` Peter Seibel
2025-01-18 9:27 ` Eli Zaretskii
0 siblings, 1 reply; 11+ messages in thread
From: Peter Seibel @ 2025-01-04 15:52 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Eli Zaretskii, Augusto Stoffel, 75336
[-- Attachment #1.1: Type: text/plain, Size: 967 bytes --]
Okay, here's an updated patch to also complete ignored files when -f or
--force is specified.
If you want I can rebase and make a single patch.
On Sat, Jan 4, 2025 at 7:04 AM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:
> >> > I was going a bit crazy trying to figure out why tab completion in
> >> > *shell* wasn't working for git add when I was trying to add a new
> >> > file to my repo. Turns out pcomplete was only completing modified
> >> > tracked files. This patch changes it so after git add it also
> >> > completes untracked non-ignored files.
> >> Augusto and Stefan, any comments?
>
> The (new) patch looks good to me.
>
> FWIW, it also makes sense occasionally to `git add` ignored files
> (e.g. we could want to track a `.elc` file in the test suite inside the
> Emacs repository to check how we handle specific old-format `.elc`
> files).
>
>
> Stefan
>
>
--
Peter Seibel
http://www.gigamonkeys.com/
[-- Attachment #1.2: Type: text/html, Size: 1579 bytes --]
[-- Attachment #2: 0003-Complete-ignored-files-when-force-specified-in-git-a.patch --]
[-- Type: application/octet-stream, Size: 1570 bytes --]
From ec55556505a47ff61d38d6c8bc5e589b02def884 Mon Sep 17 00:00:00 2001
From: Peter Seibel <peter@gigamonkeys.com>
Date: Sat, 4 Jan 2025 07:48:09 -0800
Subject: [PATCH 3/3] Complete ignored files when force specified in git add.
---
lisp/pcmpl-git.el | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lisp/pcmpl-git.el b/lisp/pcmpl-git.el
index ab5e3305865..f23002df28b 100644
--- a/lisp/pcmpl-git.el
+++ b/lisp/pcmpl-git.el
@@ -82,11 +82,16 @@ Files listed by `git ls-files ARGS' satisfy the predicate."
(pcomplete-from-help `(,vc-git-program "help" ,subcmd)
:argument
"-+\\(?:\\[no-\\]\\)?[a-z-]+=?"))))
- ;; Complete modified tracked files and untracked files
+ ;; Complete modified tracked files and untracked files and
+ ;; ignored files if -f or --force is specified.
("add"
(pcomplete-here
(pcomplete-entries
- nil (pcmpl-git--tracked-file-predicate "-o" "--exclude-standard" "-m"))))
+ nil
+ (let ((flags (list "-o" "-m")))
+ (unless (or (member "-f" pcomplete-args) (member "--force" pcomplete-args))
+ (push "--exclude-standard" flags))
+ (apply #'pcmpl-git--tracked-file-predicate flags)))))
;; Complete modified tracked files
((or "commit" "restore")
(pcomplete-here
--
2.47.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* bug#75336: [PATCH] Allow pcomplete of git add to include untracked files.
2025-01-04 15:52 ` Peter Seibel
@ 2025-01-18 9:27 ` Eli Zaretskii
2025-01-18 16:01 ` Peter Seibel
0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2025-01-18 9:27 UTC (permalink / raw)
To: Peter Seibel; +Cc: arstoffel, monnier, 75336
> From: Peter Seibel <peter@gigamonkeys.com>
> Date: Sat, 4 Jan 2025 07:52:07 -0800
> Cc: Eli Zaretskii <eliz@gnu.org>, Augusto Stoffel <arstoffel@gmail.com>, 75336@debbugs.gnu.org
>
> Okay, here's an updated patch to also complete ignored files when -f or --force is specified.
Thanks.
> If you want I can rebase and make a single patch.
Yes, please rebase on the latest master, because the patch failed to
apply when I tried.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#75336: [PATCH] Allow pcomplete of git add to include untracked files.
2025-01-18 9:27 ` Eli Zaretskii
@ 2025-01-18 16:01 ` Peter Seibel
2025-01-19 12:58 ` Eli Zaretskii
0 siblings, 1 reply; 11+ messages in thread
From: Peter Seibel @ 2025-01-18 16:01 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: arstoffel, monnier, 75336
[-- Attachment #1.1: Type: text/plain, Size: 638 bytes --]
Okay, here's a single patch. Cheers!
On Sat, Jan 18, 2025 at 1:27 AM Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Peter Seibel <peter@gigamonkeys.com>
> > Date: Sat, 4 Jan 2025 07:52:07 -0800
> > Cc: Eli Zaretskii <eliz@gnu.org>, Augusto Stoffel <arstoffel@gmail.com>,
> 75336@debbugs.gnu.org
> >
> > Okay, here's an updated patch to also complete ignored files when -f or
> --force is specified.
>
> Thanks.
>
> > If you want I can rebase and make a single patch.
>
> Yes, please rebase on the latest master, because the patch failed to
> apply when I tried.
>
--
Peter Seibel
http://www.gigamonkeys.com/
[-- Attachment #1.2: Type: text/html, Size: 1403 bytes --]
[-- Attachment #2: 0001-Improved-git-add-completion.patch --]
[-- Type: application/octet-stream, Size: 1530 bytes --]
From 01a759ca3e5784d5cd7329babb7e9429ed023ffe Mon Sep 17 00:00:00 2001
From: Peter Seibel <peter@gigamonkeys.com>
Date: Sat, 18 Jan 2025 07:54:51 -0800
Subject: [PATCH] Improved git-add completion.
---
lisp/pcmpl-git.el | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/lisp/pcmpl-git.el b/lisp/pcmpl-git.el
index f57c2d5470a..f23002df28b 100644
--- a/lisp/pcmpl-git.el
+++ b/lisp/pcmpl-git.el
@@ -82,8 +82,18 @@ Files listed by `git ls-files ARGS' satisfy the predicate."
(pcomplete-from-help `(,vc-git-program "help" ,subcmd)
:argument
"-+\\(?:\\[no-\\]\\)?[a-z-]+=?"))))
+ ;; Complete modified tracked files and untracked files and
+ ;; ignored files if -f or --force is specified.
+ ("add"
+ (pcomplete-here
+ (pcomplete-entries
+ nil
+ (let ((flags (list "-o" "-m")))
+ (unless (or (member "-f" pcomplete-args) (member "--force" pcomplete-args))
+ (push "--exclude-standard" flags))
+ (apply #'pcmpl-git--tracked-file-predicate flags)))))
;; Complete modified tracked files
- ((or "add" "commit" "restore")
+ ((or "commit" "restore")
(pcomplete-here
(pcomplete-entries
nil (pcmpl-git--tracked-file-predicate "-m"))))
--
2.47.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* bug#75336: [PATCH] Allow pcomplete of git add to include untracked files.
2025-01-18 16:01 ` Peter Seibel
@ 2025-01-19 12:58 ` Eli Zaretskii
2025-01-19 16:53 ` Peter Seibel
0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2025-01-19 12:58 UTC (permalink / raw)
To: Peter Seibel; +Cc: 75336-done, arstoffel, monnier
> From: Peter Seibel <peter@gigamonkeys.com>
> Date: Sat, 18 Jan 2025 08:01:25 -0800
> Cc: monnier@iro.umontreal.ca, arstoffel@gmail.com, 75336@debbugs.gnu.org
>
> Okay, here's a single patch. Cheers!
Thanks, installed on the master branch, and closing the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#75336: [PATCH] Allow pcomplete of git add to include untracked files.
2025-01-19 12:58 ` Eli Zaretskii
@ 2025-01-19 16:53 ` Peter Seibel
2025-01-19 17:40 ` Stefan Kangas
0 siblings, 1 reply; 11+ messages in thread
From: Peter Seibel @ 2025-01-19 16:53 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 75336-done, arstoffel, monnier
[-- Attachment #1: Type: text/plain, Size: 479 bytes --]
Awesome, thanks. Does that mean it will go out in 31.x? Or 30.x?
On Sun, Jan 19, 2025 at 4:59 AM Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Peter Seibel <peter@gigamonkeys.com>
> > Date: Sat, 18 Jan 2025 08:01:25 -0800
> > Cc: monnier@iro.umontreal.ca, arstoffel@gmail.com, 75336@debbugs.gnu.org
> >
> > Okay, here's a single patch. Cheers!
>
> Thanks, installed on the master branch, and closing the bug.
>
--
Peter Seibel
http://www.gigamonkeys.com/
[-- Attachment #2: Type: text/html, Size: 1231 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#75336: [PATCH] Allow pcomplete of git add to include untracked files.
2025-01-19 16:53 ` Peter Seibel
@ 2025-01-19 17:40 ` Stefan Kangas
0 siblings, 0 replies; 11+ messages in thread
From: Stefan Kangas @ 2025-01-19 17:40 UTC (permalink / raw)
To: Peter Seibel, Eli Zaretskii; +Cc: 75336-done, arstoffel, monnier
Peter Seibel <peter@gigamonkeys.com> writes:
> Awesome, thanks. Does that mean it will go out in 31.x? Or 30.x?
The master branch is what will eventually become Emacs 31.1.
Emacs 30.1 is in feature freeze for many months now.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2025-01-19 17:40 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-04 0:00 bug#75336: [PATCH] Allow pcomplete of git add to include untracked files Peter Seibel
2025-01-04 7:52 ` Eli Zaretskii
2025-01-04 7:54 ` Eli Zaretskii
2025-01-04 13:59 ` Peter Seibel
2025-01-04 15:04 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-04 15:52 ` Peter Seibel
2025-01-18 9:27 ` Eli Zaretskii
2025-01-18 16:01 ` Peter Seibel
2025-01-19 12:58 ` Eli Zaretskii
2025-01-19 16:53 ` Peter Seibel
2025-01-19 17:40 ` Stefan Kangas
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).