GNU bug report logs -
#16197
24.3.50; no completion on commands following "sudo" in shell and eshell
Previous Next
Reported by: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
Date: Fri, 20 Dec 2013 08:20:01 UTC
Severity: minor
Tags: fixed, patch
Found in version 24.3.50
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #52 received at 16197 <at> debbugs.gnu.org (full text, mbox):
>> Same here, I'd think that the "command name" is "xargs", but rather than
>> argue about this philosophical point, it's probably better to focus on
>> more concrete cases where this return value is a problem.
>
> I think I read somewhere that Thierry is no longer working on Emacs
> stuff... Let's see... Oh, here:
>
> https://news.ycombinator.com/item?id=24449883
>
> Hm, that's only about Helm...
>
> Anyway, this doesn't help with the sudo case, I guess?
The sudo case is the same as xargs, so it's a simple matter of
duplicating the pcomplete/xargs (or making an alias) as in the patch below.
Stefan
diff --git a/lisp/pcmpl-unix.el b/lisp/pcmpl-unix.el
index dc0d729849..8d4e7ea33d 100644
--- a/lisp/pcmpl-unix.el
+++ b/lisp/pcmpl-unix.el
@@ -83,10 +83,14 @@ pcomplete/rm
;;;###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)
diff --git a/lisp/shell.el b/lisp/shell.el
index e574aac99d..d2c41a9690 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -461,9 +461,12 @@ shell-command-completion-function
This is the value of `pcomplete-command-completion-function' for
Shell buffers. It implements `shell-completion-execonly' for
`pcomplete' completion."
- (pcomplete-here (pcomplete-entries nil
- (if shell-completion-execonly
- 'file-executable-p))))
+ (if (pcomplete-match "/")
+ (pcomplete-here (pcomplete-entries nil
+ (if shell-completion-execonly
+ 'file-executable-p)))
+ (pcomplete-here
+ (nth 2 (shell--command-completion-data)))))
(defun shell-completion-vars ()
"Setup completion vars for `shell-mode' and `read-shell-command'."
This bug report was last modified 4 years and 238 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.