Subject: bug#16197: 24.3.50; no completion on commands following "sudo" in shell and eshell

From: Thierry Volpiatto <[email-masked]>
Date: Tue, 24 Dec 2013 07:59:05 +0100

Thierry Volpiatto <[email-masked]> writes:

> Thierry Volpiatto <[email-masked]> writes:
>
>> With this I have completion on arguments of commands entered after
>> "sudo" (only in eshell though, not shell for the moment) and emacs is
>> not crashing when hitting TAB.
>
> Now I have the completion in shell also, for this
> `shell-command-completion' have to be redefined.
>
> (defun shell-command-completion ()
>   "Return the completion data for the command at point, if any."
>   (let ((filename (comint-match-partial-filename))
>         (args (split-string
>                (buffer-substring-no-properties
>                 (point) (save-excursion (shell-backward-command 1) (point))))))
>     (if (and filename
>              (save-match-data (not (string-match "[~/]" filename)))
>              (and (string= (car args) "sudo")
>                   (string= filename (cadr args))))
>         (shell--command-completion-data))))
>
> HTH, though the crash happening above should not happen.

So now my completion commands are working both with sudo and without,
the needed modifications are here if somebody is interested to fix this bug:

https://github.com/thierryvolpiatto/emacs-tv-config/blob/master/pcomplete-extension.el

Note that all pcomplete/* commands provided in emacs are not working
with "sudo".

-- 
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997