all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 16197@debbugs.gnu.org
Subject: bug#16197: 24.3.50; no completion on commands following "sudo" in shell and eshell
Date: Sun, 05 Jan 2014 08:35:57 +0100	[thread overview]
Message-ID: <8738l2hode.fsf@gmail.com> (raw)
In-Reply-To: <jwvzjnblcng.fsf-monnier+emacsbugs@gnu.org> (Stefan Monnier's message of "Sat, 04 Jan 2014 15:26:59 -0500")

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

>> Don't know what */rsh does, but */xargs is actually not working.
>
> Aha!
>
>> 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.
>
> Can you describe those problems in terms of user-visible behavior
> (i.e. a recipe) so I can better understand what the code does (and
> should do instead)?
(! is the cursor)

emacs -Q
M-x shell
$ find . -name '*.el' | xargs et!
Press TAB, nothing, no completion against "et".
M-: (shell-backward-command)
I have now the cursor at xargs:
$ find . -name '*.el' | !xargs et
To provide completion against "et" I should have the cursor at:
$ find . -name '*.el' | xargs !et
after evaling (shell-backward-command).

Now download and load:
https://github.com/thierryvolpiatto/emacs-tv-config/blob/master/pcomplete-extension.el
And repeat the same recipe.

For `pcomplete-command-name' it is harder to give a recipe, the best is
to edebug it to have an idea (be careful the actual version is crashing
emacs sometimes).

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

Done in pcomplete-extension.el.

>> Don't think so, I think the problem should be fixed at another level as
>> descripted above.
>
> I missed the description, I'm afraid.
>
>> https://github.com/thierryvolpiatto/emacs-tv-config/blob/master/pcomplete-extension.el
>
> Not sure what I should look at there.

- pcomplete/sudo
- shell-backward-command
- pcomplete-command-name

> Can you send it as a patch against pcmpl-unix.el to fix pcomplete/xargs
> (and add pcomplete/sudo at the same time)?

Not only against pcmpl-unix.el I think:

* pcmpl-unix.el: Add `pcomplete/sudo'.
* pcomplete.el: Redefine `pcomplete-command-name'.
* shell.el: Redefine `shell-backward-command'.

Not urgent:

I would be happy to give also pcomplete/find,hg,ls,apt-get.
Not sure where they would go in this case, pcmpl-linux? unix? gnu?

Also more things to fix are `pcomplete/tar', `pcomplete/ssh' and maybe
others (allow completion on more than one arg), but I haven't worked on
this already.

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





  reply	other threads:[~2014-01-05  7:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-20  8:18 bug#16197: 24.3.50; no completion on commands following "sudo" in shell and eshell Thierry Volpiatto
2013-12-23  8:36 ` Thierry Volpiatto
2013-12-23 10:21   ` Thierry Volpiatto
2013-12-24  6:59     ` Thierry Volpiatto
2013-12-24 10:49       ` Thierry Volpiatto
2014-01-03 22:53         ` Stefan Monnier
2014-01-04  5:33           ` Thierry Volpiatto
2014-01-04  7:11             ` Thierry Volpiatto
2014-01-04 20:26             ` Stefan Monnier
2014-01-05  7:35               ` Thierry Volpiatto [this message]
2020-09-25 17:51                 ` Stefan Monnier
2020-09-26 13:09                   ` Lars Ingebrigtsen
2020-09-26 22:17                     ` Stefan Monnier
2020-09-27 12:08                       ` Lars Ingebrigtsen
2020-09-28  2:07                         ` Stefan Monnier
2020-09-28 11:12                           ` Lars Ingebrigtsen
2014-01-07 13:11               ` Thierry Volpiatto
2020-09-25 10:44                 ` Lars Ingebrigtsen
2014-01-07 15:26               ` Thierry Volpiatto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8738l2hode.fsf@gmail.com \
    --to=thierry.volpiatto@gmail.com \
    --cc=16197@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.