[EShell] Don’t barf if git commands cannot be found
This commit is contained in:
parent
e7ab32951b
commit
46400826eb
|
@ -62,17 +62,18 @@
|
||||||
(defun pcmpl-git-commands ()
|
(defun pcmpl-git-commands ()
|
||||||
"Return the most common git commands by parsing the git output."
|
"Return the most common git commands by parsing the git output."
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(call-process "git" nil (current-buffer) nil "help" "--all")
|
(if (not (zerop (call-process "git" nil (current-buffer) nil "help" "--all")))
|
||||||
(goto-char 0)
|
(warn "Cannot call `git’ to obtain list of available commands; completion won’t be available.")
|
||||||
(search-forward "available git commands in")
|
(goto-char 0)
|
||||||
(let (commands)
|
(search-forward "available git commands in")
|
||||||
(while (re-search-forward
|
(let (commands)
|
||||||
"^[[:blank:]]+\\([[:word:]-.]+\\)[[:blank:]]*\\([[:word:]-.]+\\)?"
|
(while (re-search-forward
|
||||||
nil t)
|
"^[[:blank:]]+\\([[:word:]-.]+\\)[[:blank:]]*\\([[:word:]-.]+\\)?"
|
||||||
(push (match-string 1) commands)
|
nil t)
|
||||||
(when (match-string 2)
|
(push (match-string 1) commands)
|
||||||
(push (match-string 2) commands)))
|
(when (match-string 2)
|
||||||
(sort commands #'string<))))
|
(push (match-string 2) commands)))
|
||||||
|
(sort commands #'string<)))))
|
||||||
|
|
||||||
(defconst pcmpl-git-commands (pcmpl-git-commands)
|
(defconst pcmpl-git-commands (pcmpl-git-commands)
|
||||||
"List of `git' commands.")
|
"List of `git' commands.")
|
||||||
|
|
Loading…
Reference in New Issue