unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Oleksandr Manzyuk <manzyuk@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 10457@debbugs.gnu.org
Subject: bug#10457: (Broken?) programmable completion in shell buffers
Date: Mon, 9 Jan 2012 15:41:47 +0000	[thread overview]
Message-ID: <CAAwZTsQCHbdc93oP2onzfyoEKbjaD1+TUWLxSchSM=hm4O1vpA@mail.gmail.com> (raw)
In-Reply-To: <jwvipklhedc.fsf-monnier+emacs@gnu.org>

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





  parent reply	other threads:[~2012-01-09 15:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-08 19:40 bug#10457: (Broken?) programmable completion in shell buffers Oleksandr Manzyuk
2012-01-08 20:07 ` bug#10457: Oleksandr Manzyuk
2012-01-09  1:26 ` bug#10457: (Broken?) programmable completion in shell buffers Stefan Monnier
2012-01-09  5:56   ` Thierry Volpiatto
2012-01-09 11:17     ` Thierry Volpiatto
     [not found]     ` <mailman.1502.1326107965.15002.bug-gnu-emacs@gnu.org>
2012-01-10 23:27       ` manzyuk
2012-01-09 15:41   ` Oleksandr Manzyuk [this message]
2012-01-09 17:41     ` Oleksandr Manzyuk
2012-01-09 20:20       ` Oleksandr Manzyuk
2012-01-24 18:12         ` Glenn Morris
2012-01-24 18:14   ` Glenn Morris
2012-01-24 18:28     ` Oleksandr Manzyuk
2012-01-24 21:39       ` Glenn Morris
2012-01-24 22:29         ` Oleksandr Manzyuk

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='CAAwZTsQCHbdc93oP2onzfyoEKbjaD1+TUWLxSchSM=hm4O1vpA@mail.gmail.com' \
    --to=manzyuk@gmail.com \
    --cc=10457@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).