all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Peter Seibel <peter@gigamonkeys.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Augusto Stoffel <arstoffel@gmail.com>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	75336@debbugs.gnu.org
Subject: bug#75336: [PATCH] Allow pcomplete of git add to include untracked files.
Date: Sat, 4 Jan 2025 05:59:18 -0800	[thread overview]
Message-ID: <CALHiJMbC5o30X+vxCLWqfoJJBaTNABFuLveE6dwstQE16=nw7Q@mail.gmail.com> (raw)
In-Reply-To: <86frlzf1zo.fsf@gnu.org>


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


  reply	other threads:[~2025-01-04 13:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALHiJMbC5o30X+vxCLWqfoJJBaTNABFuLveE6dwstQE16=nw7Q@mail.gmail.com' \
    --to=peter@gigamonkeys.com \
    --cc=75336@debbugs.gnu.org \
    --cc=arstoffel@gmail.com \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.