Fix pcomplete completion of things like xargs and sudo (bug#16197)

* lisp/pcmpl-unix.el (pcomplete/xargs): Don't `pcomplete-this` around
`pcomplete-command-completion-function`.
(pcomplete/sudo): Make it an alias for `pcomplete/xargs`.

* lisp/shell.el (shell-command-completion-function): Return the
names from `exec-path` when the command name has no `/`.
This commit is contained in:
Stefan Monnier 2020-09-27 22:07:14 -04:00
parent 4155ca273a
commit ba42f79324
2 changed files with 11 additions and 4 deletions

View file

@ -82,10 +82,14 @@ being via `pcmpl-ssh-known-hosts-file'."
;;;###autoload
(defun pcomplete/xargs ()
"Completion for `xargs'."
(pcomplete-here (funcall pcomplete-command-completion-function))
;; FIXME: Add completion of xargs-specific arguments.
(funcall pcomplete-command-completion-function)
(funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
pcomplete-default-completion-function)))
;; FIXME: Add completion of sudo-specific arguments.
(defalias 'pcomplete/sudo #'pcomplete/xargs)
;;;###autoload
(defalias 'pcomplete/time 'pcomplete/xargs)