branch: elpa/pcmpl-args
commit 6d45d2d7c16169faca2ed47b922c74f33e16e4c5
Author: Valeriy Litkovskyy <vlr.ltk...@protonmail.com>
Commit: Troy Hinckley <t.mac...@gmail.com>

    Fixed too many subcommmands for git completions
    
    2021-07-19  Valeriy Litkovskyy  <vlr.ltk...@protonmail.com>
    
            * pcmpl-args.el (pcmpl-args-git-commands): it does not give too
            many subcommands anymore.  Help annotations for subcommands are
            now correctly set.
---
 pcmpl-args.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/pcmpl-args.el b/pcmpl-args.el
index 9388f67624..4e455e5a0f 100644
--- a/pcmpl-args.el
+++ b/pcmpl-args.el
@@ -3129,10 +3129,15 @@ options found in its man page."
       (pcmpl-args-process-file "git" "help" "-a")
       (goto-char (point-min))
       (let ((cmds (copy-sequence pcmpl-args-git-commands)))
-        (while (re-search-forward "^[ ]+[[:alpha:]].*$" nil t)
-          (dolist (cmd (split-string (match-string 0)))
+        (while (re-search-forward
+                "^[\t\s]+\\([^[:space:]]+\\)[\t\s]*\\([^[:space:]]*\\)$"
+                nil t)
+          (let ((cmd (match-string 1))
+                (help (match-string 2)))
+            (when (member help '(nil ""))
+              (setq help "..."))
             (unless (assoc cmd cmds)
-              (push (list cmd "...") cmds))))
+              (push (list cmd help) cmds))))
         (setq cmds
               (sort cmds (lambda (a b) (string-lessp (car a) (car b)))))
         (pcmpl-args-completion-table-with-annotations

Reply via email to