Subject: bug#10457: (Broken?) programmable completion in shell buffers

From: Oleksandr Manzyuk <[email-masked]>
Date: Mon, 9 Jan 2012 20:20:55 +0000

I don't yet fully understand what is going on here, but I think I have
a fix (arguably, not very attractive) for the lockup problem: if I
replace the line

(pcomplete-opt "01234567ABCFGKLMNOPRSTUVWXZbcdfghiklmoprstuvwxz")

in the code for `pcomplete/tar' in pcmpl-gnu.el with

(pcomplete-here*
 (mapcar
  (lambda (char)
    (concat "-" (char-to-string char)))
  (string-to-list
   "01234567ABCFGKLMNOPRSTUVWXZbcdfghiklmoprstuvwxz")))

then I finally get the behavior I am after: typing "tar -" and
pressing TAB pops up a completions buffer with short options, and if I
press SPC now, the completions buffer is popped down (ditto for "tar
--").

The two versions seem to be equivalent modulo bookkeeping, except that
`pcomplete-here*' runs `pcomplete-try-first-hook'.  Why are they
operationally different?

Sasha
-- 
Oleksandr Manzyuk
http://oleksandrmanzyuk.wordpress.com
diff --git a/lisp/pcmpl-gnu.el b/lisp/pcmpl-gnu.el
index 6ce51d1..8ac86ac 100644
--- a/lisp/pcmpl-gnu.el
+++ b/lisp/pcmpl-gnu.el
@@ -241,7 +241,12 @@
                    "--verify"
                    "--version"
                    "--volno-file=")))
-          (pcomplete-opt "01234567ABCFGKLMNOPRSTUVWXZbcdfghiklmoprstuvwxz"))
+          (pcomplete-here*
+           (mapcar
+            (lambda (char)
+              (concat "-" (char-to-string char)))
+            (string-to-list
+             "01234567ABCFGKLMNOPRSTUVWXZbcdfghiklmoprstuvwxz"))))
         (cond
          ((pcomplete-match "\\`--after-date=" 0)
           (pcomplete-here*))