all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: reza <reza@housseini.me>, 58921@debbugs.gnu.org
Cc: monnier@iro.umontreal.ca
Subject: bug#58921: Tab completion hangs in eshell
Date: Thu, 9 Feb 2023 23:34:52 -0800	[thread overview]
Message-ID: <537afe67-809e-c09b-db84-05f41ba5d3b4@gmail.com> (raw)
In-Reply-To: <010201842d4961c3-56e13f9e-0c67-4fd2-9731-657c131da32c-000000@eu-west-1.amazonses.com>

[-- Attachment #1: Type: text/plain, Size: 563 bytes --]

X-Debbugs-Cc: monnier@iro.umontreal.ca

On 10/31/2022 2:04 AM, reza via Bug reports for GNU Emacs, the Swiss 
army knife of text editors wrote:
> Open an eshell:
> 
>       M-x eshell <enter>
> 
> Type this command in the eshell
> 
>       tab --warning=no-timestamp -xf <tab>
> 
> emacs will hang and has to be killed.
> 
> This behavior does not occur when only typing
> 
>       tar -xf <tab>

I believe the attached patch fixes this. It ensures that even when 
'pcomplete/tar' encounters an option it doesn't recognize, it continues 
to make forward progress.

[-- Attachment #2: 0001-Fix-Pcompletion-of-tar-when-using-unrecognized-argum.patch --]
[-- Type: text/plain, Size: 3556 bytes --]

From b11cfb6fc1cbb52b88425f66b4dc503b9e3cd543 Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Thu, 9 Feb 2023 23:27:50 -0800
Subject: [PATCH] Fix Pcompletion of "tar" when using unrecognized arguments

Previously, arguments to tar like "--warning=no-timestamp" would cause
Pcompletion to hang (bug#58921).

* lisp/pcmpl-gnu.el (pcomplete/tar): Properly handle completion of
arguments that look like "--ARG=", even if they're not recognized by
this function.  (This also lets us coalesce a lot of the different
cases into one.)
---
 lisp/pcmpl-gnu.el | 24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/lisp/pcmpl-gnu.el b/lisp/pcmpl-gnu.el
index 7d270ea789f..00e9af3a974 100644
--- a/lisp/pcmpl-gnu.el
+++ b/lisp/pcmpl-gnu.el
@@ -276,20 +276,12 @@ pcomplete/tar
       (cond
        ((pcomplete-match "\\`-\\'" 0)
         (pcomplete-here*))
-       ((pcomplete-match "\\`--after-date=" 0)
-        (pcomplete-here*))
-       ((pcomplete-match "\\`--backup=" 0)
-        (pcomplete-here*))
-       ((pcomplete-match "\\`--blocking-factor=" 0)
-        (pcomplete-here*))
        ((pcomplete-match "\\`--directory=\\(.*\\)" 0)
         (pcomplete-here* (pcomplete-dirs)
                          (pcomplete-match-string 1 0)))
        ((pcomplete-match "\\`--exclude-from=\\(.*\\)" 0)
         (pcomplete-here* (pcomplete-entries)
                          (pcomplete-match-string 1 0)))
-       ((pcomplete-match "\\`--exclude=" 0)
-        (pcomplete-here*))
        ((pcomplete-match "\\`--\\(extract\\|list\\)\\'" 0)
         (setq complete-within t))
        ((pcomplete-match "\\`--file=\\(.*\\)" 0)
@@ -304,36 +296,26 @@ pcomplete/tar
        ((pcomplete-match "\\`--info-script=\\(.*\\)" 0)
         (pcomplete-here* (pcomplete-entries)
                          (pcomplete-match-string 1 0)))
-       ((pcomplete-match "\\`--label=" 0)
-        (pcomplete-here*))
-       ((pcomplete-match "\\`--mode=" 0)
-        (pcomplete-here*))
        ((pcomplete-match "\\`--new-volume-script=\\(.*\\)" 0)
         (pcomplete-here* (pcomplete-entries)
                          (pcomplete-match-string 1 0)))
-       ((pcomplete-match "\\`--newer=" 0)
-        (pcomplete-here*))
        ((pcomplete-match "\\`--owner=\\(.*\\)" 0)
         (pcomplete-here* (pcmpl-unix-user-names)
                          (pcomplete-match-string 1 0)))
-       ((pcomplete-match "\\`--record-size=" 0)
-        (pcomplete-here*))
        ((pcomplete-match "\\`--rsh-command=\\(.*\\)" 0)
         (pcomplete-here* (funcall pcomplete-command-completion-function)
                          (pcomplete-match-string 1 0)))
        ((pcomplete-match "\\`--starting-file=\\(.*\\)" 0)
         (pcomplete-here* (pcomplete-entries)
                          (pcomplete-match-string 1 0)))
-       ((pcomplete-match "\\`--suffix=" 0)
-        (pcomplete-here*))
-       ((pcomplete-match "\\`--tape-length=" 0)
-        (pcomplete-here*))
        ((pcomplete-match "\\`--use-compress-program=\\(.*\\)" 0)
         (pcomplete-here* (funcall pcomplete-command-completion-function)
                          (pcomplete-match-string 1 0)))
        ((pcomplete-match "\\`--volno-file=\\(.*\\)" 0)
         (pcomplete-here* (pcomplete-entries)
-                         (pcomplete-match-string 1 0)))))
+                         (pcomplete-match-string 1 0)))
+       ((pcomplete-match "\\`--.*=" 0)
+        (pcomplete-here*))))
     (unless saw-option
       (pcomplete-here
        (mapcar #'char-to-string
-- 
2.25.1


  parent reply	other threads:[~2023-02-10  7:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2cb2b8aa-0813-5eae-3bfc-27831b3d50dd@housseini.me>
2022-10-31  9:04 ` bug#58921: Tab completion hangs in eshell reza via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-02  7:28   ` Gerd Möllmann
2023-02-10  7:34   ` Jim Porter [this message]
2023-02-23  6:57     ` Jim Porter
2023-02-23 18:08     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-23 19:25       ` Jim Porter
2023-02-23 19:34         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-23 20:43           ` Jim Porter
2023-03-04  5:37             ` Jim Porter
2023-03-08 23:53               ` Jim Porter

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=537afe67-809e-c09b-db84-05f41ba5d3b4@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=58921@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=reza@housseini.me \
    /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.