bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Thierry Volpiatto
Subject: bug#16197: 24.3.50; no completion on commands following "sudo" in shell and eshell
Date: Sat, 04 Jan 2014 06:33:02 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Maybe because you are using pcomplete-match with an hard coded value of
>> 0 for index.(Not tested)
>
> Not sure who "you" is.

Whoever wrote pcomplete/tar.

> I'm afraid your description of the problem, solutions, and problems of
> those solutions is a bit too cryptic for me.
>
> Here's my starting point:
> - I understand that currently pcomplete does not provide completion for
>   "sudo" and it would be nice to add it.
> - "sudo" is not particularly special, so whatever solution is used for
>   it should also work for many other commands.
> - There is already pcomplete/xargs and pcomplete/rsh.

Don't know what */rsh does, but */xargs is actually not working.
Same for tar as described in previous posts.

> Can pcomplete/sudo use the same approach as pcomplete/xargs and pcomplete/rsh?
> If not, why not?

Well I didn't read */xargs, but here are the problems:

- `pcomplete-command-name' actually is always returning the first arg of
  command line e.g for "sudo apt-get" it is returning "sudo".

- `shell-command-completion' is trying to complete after what
  `shell-backward-command' returns, which is actually the first command
  near prompt or "[&;|]+ ", so when you try to complete after sudo or
  xargs, you call the completion against "sudo" or "xargs" which returns
  nothing of course.

Actually the fix made to these two functions is affecting only sudo, but
I can easily fix it to handle also 'xargs'.

> If yes but there are still problems, do those problems also affect
> pcomplete/xargs and pcomplete/rsh?
> If not, why not?
>
> If yes, then let's first focus on fixing pcomplete/xargs.

Don't think so, I think the problem should be fixed at another level as
descripted above.

You can look at the code here:

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

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]