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

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

bug#10457: (Broken?) programmable completion in shell buffers


From: Oleksandr Manzyuk
Subject: bug#10457: (Broken?) programmable completion in shell buffers
Date: Mon, 9 Jan 2012 15:41:47 +0000

On Mon, Jan 9, 2012 at 1:26 AM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> First, I'm unable to complete options to commands.  Take, for example,
>> "ssh".  If I'm in my home directory, type "ssh -", and hit TAB, the
>> command line changes to "ssh .-", and when I hit TAB again, a
>> completions buffer pops up showing only the file and directory names
>> starting with a dot and containing a dash.  I assume that instead of
>> offering the options available for ssh, Emacs performs some sort of
>> "fuzzy" matching against file and directory names.
>
> It's partial-completion at work: "a-b" matches "a*-b*" and "-" just
> matches "*-*".  Apparently all your file names that contained "-"
> started with ".", hence the ".-".
>
>> Is this the intended behavior, and if so, how can I disable this
>> fuzzy matching?
>
> You can remove partial-completion from completion-styles.

Thanks for the explanation.  I'll keep it for a while, maybe I like it.

>> TAB.  When I am in a directory that doesn't contain files with a dash
>> in the name, typing "ssh -" and hitting TAB produces only "No match"
>> message in the minibuffer.
>
> Indeed, pcomplete doesn't seem to provide any completion for ssh's "-"
> options, currently, even though the code does do something for it:
>
> (defun pcomplete/ssh ()
>  "Completion rules for the `ssh' command."
>  (pcomplete-opt "1246AaCfgKkMNnqsTtVvXxYbcDeFiLlmOopRSw")
>  (pcomplete-here (pcmpl-ssh-hosts)))
>
> I don't think completion of "-" is very useful for ssh since there's no
> long options, and most ascii letters are valid options, but still it
> seems we have a bug that prevents pcomplete-opt from doing its job.

I have just finished building Emacs from the savannah repo, and this
problem seems to be gone.  Now when I type "ssh -" and hit TAB, a
completions buffer showing a list of one-letter options pops up.  BTW,
even though I have file names containing dashes, I no longer observe
the behavior I described in my previous email: it seems that
completion of options correctly takes preference over
`partial-completion'.  Ssh was only an example -- I couldn't get
completions for any command with options.  In particular, tar admits
long options, which I was unable to access via completion.  Now it
works fine with tar too: typing "tar -" and hitting TAB shows a
completions buffer with one-letter options, typing "tar --" and
hitting TAB pops up a completions buffer with long options.

HOWEVER, curiously, the issue with Emacs being locked as a result of
typing "tar -" and hitting TAB followed by SPC in a shell buffer is
still present.  Typing "tar --" and hitting TAB pops up a completions
buffer, and hitting SPC flushes it, as it should.  I am mystified.
Can anybody else confirm this issue?

Sasha

-- 
Oleksandr Manzyuk
http://oleksandrmanzyuk.wordpress.com





reply via email to

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