zsh-users
 help / color / mirror / code / Atom feed
* completion not inserting matches
@ 2004-04-18 14:17 Thorsten Kampe
  2004-04-18 23:20 ` Bart Schaefer
  2004-04-18 23:35 ` Bart Schaefer
  0 siblings, 2 replies; 6+ messages in thread
From: Thorsten Kampe @ 2004-04-18 14:17 UTC (permalink / raw)
  To: zsh-users

I have the following directories in /usr/src:

linux@
linux-2.4.20-wolk4.9s-r6/
linux-2.4.20-wolk4.11s-r3/
linux-2.4.25-gentoo-r2/
linux-2.4.25_pre7-gss-r3/
linux-2.6.5-gentoo-r1/

Now I am in /usr/src and want to change to "linux-2.4.20-wolk4.11s-r3"
by typing

,---
| root@wolfbrand# cd r3<TAB>
| root@wolfbrand# cd linux-2.4.2--<TAB>-sr3
|                                ^ Cursor jumps to this point
| local directory
| linux-2.4.20-wolk4.11s-r3/  linux-2.4.25_pre7-gss-r3/
| root@wolfbrand# cd linux-2.4.2---sr3
|                                     ^ Cursor jumps to the end
| No match for: `local directory', `directory in cdpath', `user', `named directory', or `corrections'
`---

So the Completion System is correctly showing the possible two matches
on the first <TAB>, but doesn't doesn't insert them at the second
<TAB> and instead tells me now that there are /no matches/!

These are my completion settings: [1] and [2]. One "culprit" is

# case-insensitive and partial-word then substring
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z} m:[-._]=[-._] r:|[-./_]=** r:|=*' '+l:|=*'

and more precisely the "partial word" completion "r:|[-./_]=** r:|=*"
(which is directly taken from the user's guide).

So what am I doing wrong? Am I trying "to complete too much"?


Thorsten

[1]
,---
| setopt   alwayslastprompt
| unsetopt alwaystoend
| setopt   autoparamkeys
| setopt   autoparamslash
| setopt   autoremoveslash
| setopt   completealiases
| setopt   completeinword
| 
| # ambigious completions
| setopt   autolist
| setopt   automenu
| unsetopt bashautolist
| unsetopt beep
| unsetopt listambiguous
| unsetopt listbeep
| unsetopt menucomplete
| unsetopt recexact
|
| # displaying completions
| setopt   listpacked
| setopt   listrowsfirst
| setopt   listtypes
`---

[2]
,---
| # contexts: ':completion:<function>:<completer>:<command>:<arg>:<tag>' <style> <value> (^Xh)
| autoload -U compinit; compinit -C   # completion system
| 
| zstyle ':completion:*' auto-description "specifies %d"
| zstyle ':completion:*' commands         broken ineed iuse needsme pause restart start status stop usesme zap
| zstyle ':completion:*' completer        _expand _complete _approximate _ignored
| zstyle ':completion:*' domains          thorstenkampe.de
| zstyle ':completion:*' group-name       ''
| zstyle ':completion:*' ignore-parents   parent pwd
| zstyle ':completion:*' list-colors      ${(s.:.)LS_COLORS}
| zstyle ':completion:*' list-prompt      "%{${ltgreen}%}last line %l (%p)%{${reset_color}%}  %{${ltwhite}%}last match %m%{${reset_color}%}"
| # case-insensitive and partial-word then substring
| zstyle ':completion:*' matcher-list     'm:{a-zA-Z}={A-Za-z} m:[-._]=[-._] r:|[-./_]=** r:|=*' '+l:|=*'
| zstyle ':completion:*' menu             select=10 select=long-list
| zstyle ':completion:*' prefix-needed    false
| zstyle ':completion:*' remote-access    false
| zstyle ':completion:*' select-prompt    "%{${ltgreen}%}line %l (%p)%{${reset_color}%}  %{${ltwhite}%}match %m%{${reset_color}%}"
| zstyle ':completion:*' select-scroll    -1
| zstyle ':completion:*' sort             true
| zstyle ':completion:*' verbose          yes
| 
| zstyle ':completion::approximate*:*'  insert-unambiguous true
| zstyle ':completion:*:approximate:*'  max-errors         2  # more than '2' degrades performance regardless of "matcher-list"
| zstyle ':completion:*:approximate*:*' original           false
| 
| zstyle ':completion::complete:*' use-cache true
| 
| zstyle ':completion:*:expand:*' accept-exact     continue
| zstyle ':completion:*:expand:*' add-space        file
| zstyle ':completion:*:expand:*' glob             true
| zstyle ':completion:*:expand:*' keep-prefix      true
| zstyle ':completion:*:expand:*' subst-globs-only true
| zstyle ':completion:*:expand:*' substitute       true
| zstyle ':completion:*:expand:*' suffix           true
| zstyle ':completion::expand:*'  tag-order        all-expansions
| 
| zstyle ':completion:*:ignored:*' single-ignored show
| 
| zstyle ':completion:*:corrections'  format "%{${ltyellow}%}%d (errors: %e)%{${reset_color}%}"
| zstyle ':completion:*:descriptions' format "%{${ltgreen}%}%d%{${reset_color}%}"
| zstyle ':completion:*:messages'     format "%{${ltgreen}%}%d%{${reset_color}%}"
| zstyle ':completion:*:warnings'     format "%{${ltred}%}No match for%{${reset_color}%}: %d"
| 
| zstyle ':completion:*:files'                      list-suffixes     true
| zstyle ':completion::(^approximate*):*:functions' ignored-patterns  '_*'
| zstyle ':completion:*:jobs'                       list-colors       'no=01;31'
| zstyle ':completion:*:manuals'                    separate-sections true
| 
| zstyle ':completion:*:paths' ambiguous       true
| zstyle ':completion:*:paths' expand          suffix
| zstyle ':completion:*:paths' preserve-prefix "?:/"  # "C:\" style
| zstyle ':completion:*:paths' special-dirs    ..
| 
| zstyle ':completion:*:processes' command     'ps -e'
| zstyle ':completion:*:processes' insert-ids  single
| zstyle ':completion:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
| 
| zstyle ':completion:*:complete:dpkg:option--status-1:*' packageset avail
| 
| autoload -U predict-on; predict-on
| zle-line-init() { predict-on }
| zle -N zle-line-init
| zle -N predict-on
| zle -N predict-off
| bindkey '^P'   predict-on
| bindkey '^Xp'  predict-off
| bindkey '^X^P' predict-off
| zstyle ':predict' toggle  true
| zstyle ':predict' verbose true
| 
| zstyle ':completion:predict::::' cursor complete key
| zstyle ':completion:predict::::' list   always
`---


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: completion not inserting matches
  2004-04-18 14:17 completion not inserting matches Thorsten Kampe
@ 2004-04-18 23:20 ` Bart Schaefer
  2004-04-19 15:40   ` Thorsten Kampe
  2004-04-18 23:35 ` Bart Schaefer
  1 sibling, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2004-04-18 23:20 UTC (permalink / raw)
  To: zsh-users

On Apr 18,  4:17pm, Thorsten Kampe wrote:
}
} | root@wolfbrand# cd r3<TAB>
} | root@wolfbrand# cd linux-2.4.2---sr3
} |                                ^ Cursor jumps to this point
} | local directory
} | linux-2.4.20-wolk4.11s-r3/  linux-2.4.25_pre7-gss-r3/

At this point things are a little messed up.  Note that there isn't any
matching file that actually has three hyphens; those are standing in for
"-.-" in the first match and "_--" in the second match.  Also, the right
completion would be "linux-2.4.2--s-r3", so I'm not sure how the final
hyphen and the "s" are becoming transposed.

} | root@wolfbrand# cd linux-2.4.2--<TAB>-sr3

That doesn't match where you said the cursor was.  Did you move the
cursor to the right before pressing TAB, or should that have said

    root@wolfbrand# cd linux-2.4.2-<TAB>--sr3

??

If I understand correctly, you were expecting this to take you into menu
completion cycling between the two previous matches.  I confess I don't
know why it does not, except that it may be related to the transposed "s".

} These are my completion settings: [1] and [2].

It'd be a little easier to work with these if they didn't have the ascii
art border.  As it is it's not possible to cut'n'paste them into a shell
to duplicate your setup.

I do notice that you're not using the _oldlist completer.  You might try
adding that to the front of your list of completers and see if it helps.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: completion not inserting matches
  2004-04-18 14:17 completion not inserting matches Thorsten Kampe
  2004-04-18 23:20 ` Bart Schaefer
@ 2004-04-18 23:35 ` Bart Schaefer
  2004-04-19 14:42   ` Thorsten Kampe
  1 sibling, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2004-04-18 23:35 UTC (permalink / raw)
  To: zsh-users

On Apr 18,  4:17pm, Thorsten Kampe wrote:
}
} These are my completion settings: [1] and [2].

Hrm.

I just edited up a source-able file of your settings, deleted all my own
zstyles, sourced the file, and set up a dummy directory:

schaefer<574> ls                           
linux/                      linux-2.4.25-gentoo-r2/
linux-2.4.20-wolk4.11s-r3/  linux-2.4.25_pre7-gss-r3/
linux-2.4.20-wolk4.9s-r6/   linux-2.6.5-gentoo-r1/
schaefer<575> cd r3<TAB>
schaefer<575> cd linux-2.4.2---sr3
local directory
linux-2.4.20-wolk4.11s-r3/  linux-2.4.25_pre7-gss-r3/ 
schaefer<575> cd linux-2.4.2-<TAB>--sr3
schaefer<575> cd linux-2.4.20-wolk4.11s-r3/<TAB>
schaefer<575> cd linux-2.4.20-wolk4.9s-r6/<TAB>
schaefer<575> cd linux-2.4.25-gentoo-r2/<TAB>
schaefer<575> cd linux-2.4.25_pre7-gss-r3/<TAB>
schaefer<575> cd linux-2.4.2---sr3

So I've got menu completion going, but it's cycling through four choices,
not just the original two matches.

This is with the very latest 4.2.0-dev-1 from CVS.  I suppose it's possible
I have a setopt that you don't -- these are all the ones that might matter:

alwayslastprompt      on
alwaystoend           off
autocd                on
autolist              on
automenu              on
autonamedirs          off
autoparamkeys         on
autoparamslash        on
autoremoveslash       on
bashautolist          off
beep                  off
caseglob              on
cdablevars            off
chasedots             off
chaselinks            off
completealiases       on
completeinword        on
correct               on
correctall            off
equals                on
globcomplete          off
listambiguous         off
listbeep              off
listpacked            on
listrowsfirst         on
listtypes             on
menucomplete          off


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: completion not inserting matches
  2004-04-18 23:35 ` Bart Schaefer
@ 2004-04-19 14:42   ` Thorsten Kampe
  0 siblings, 0 replies; 6+ messages in thread
From: Thorsten Kampe @ 2004-04-19 14:42 UTC (permalink / raw)
  To: zsh-users

* Bart Schaefer (2004-04-19 01:35 +0100)
> On Apr 18,  4:17pm, Thorsten Kampe wrote:
> } These are my completion settings: [1] and [2].
> 
> Hrm.
> 
> I just edited up a source-able file of your settings, deleted all my own
> zstyles, sourced the file, and set up a dummy directory:
> 
> schaefer<574> ls                           
> linux/                      linux-2.4.25-gentoo-r2/
> linux-2.4.20-wolk4.11s-r3/  linux-2.4.25_pre7-gss-r3/
> linux-2.4.20-wolk4.9s-r6/   linux-2.6.5-gentoo-r1/
> schaefer<575> cd r3<TAB>
> schaefer<575> cd linux-2.4.2---sr3
> local directory
> linux-2.4.20-wolk4.11s-r3/  linux-2.4.25_pre7-gss-r3/ 
> schaefer<575> cd linux-2.4.2-<TAB>--sr3
> schaefer<575> cd linux-2.4.20-wolk4.11s-r3/<TAB>
> schaefer<575> cd linux-2.4.20-wolk4.9s-r6/<TAB>
> schaefer<575> cd linux-2.4.25-gentoo-r2/<TAB>
> schaefer<575> cd linux-2.4.25_pre7-gss-r3/<TAB>
> schaefer<575> cd linux-2.4.2---sr3
> 
> So I've got menu completion going, but it's cycling through four choices,
> not just the original two matches.
> 
> This is with the very latest 4.2.0-dev-1 from CVS.  I suppose it's possible
> I have a setopt that you don't -- these are all the ones that might matter:
> 
> [setopts]

I wasn't able to reproduce your "cycle through four choices" by
setting your options.

Thorsten


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: completion not inserting matches
  2004-04-18 23:20 ` Bart Schaefer
@ 2004-04-19 15:40   ` Thorsten Kampe
  2004-04-20  4:23     ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Thorsten Kampe @ 2004-04-19 15:40 UTC (permalink / raw)
  To: zsh-users

* Bart Schaefer (2004-04-19 01:20 +0100)
> On Apr 18,  4:17pm, Thorsten Kampe wrote:
> } | root@wolfbrand# cd r3<TAB>
> } | root@wolfbrand# cd linux-2.4.2---sr3
> } |                                ^ Cursor jumps to this point
> } | local directory
> } | linux-2.4.20-wolk4.11s-r3/  linux-2.4.25_pre7-gss-r3/
> 
> At this point things are a little messed up.  Note that there isn't any
> matching file that actually has three hyphens; those are standing in for
> "-.-" in the first match and "_--" in the second match.

Yes.

Without "m:[-._]=[-._]"      it completes to "linux-2.4.2--sr3"
Without "r:|[-./_]=** r:|=*" it completes to "s-r3"

> Also, the right completion would be "linux-2.4.2--s-r3", so I'm not
> sure how the final hyphen and the "s" are becoming transposed.

Yes. Another oddity:

root@wolfbrand# cd 20<TAB>
root@wolfbrand# cd linux-2..420-wolk4.
local directory
linux-2.4.20-wolk4.9s-r6/   linux-2.4.20-wolk4.11s-r3/

...while it should complete to "linux-2.4.20-wolk4." (the longest
unambiguous part). In this case it cycles through the completions.
 
> } | root@wolfbrand# cd linux-2.4.2--<TAB>-sr3
> 
> That doesn't match where you said the cursor was.  Did you move the
> cursor to the right before pressing TAB, or should that have said
> 
>     root@wolfbrand# cd linux-2.4.2-<TAB>--sr3
> 
> ??

Yes, "-<TAB>--" is more accurate as the cursor sits and blinks on the
middle hyphen "-".
 
> If I understand correctly, you were expecting this to take you into menu
> completion cycling between the two previous matches.  I confess I don't
> know why it does not, except that it may be related to the transposed "s".

Actually I had a phenomenon yesterday while trying to complete some
directories in /usr/src like the one mentioned, where pressing <TAB> a
second time resulted in a "logout" (first log out of "screen" and then
on a third TAB out of the shell thereby closing the ssh connection). I
could reproduce this. So I thought that I had really messed things up.
 
> } These are my completion settings: [1] and [2].
> 
> It'd be a little easier to work with these if they didn't have the ascii
> art border.  As it is it's not possible to cut'n'paste them into a shell
> to duplicate your setup.

These "ascii art borders" are "box quotes" and supposed to make the
quoted text more readable and structured (and it prevents unwanted
linebreaks), but I learned my lesson...
 
> I do notice that you're not using the _oldlist completer.  You might try
> adding that to the front of your list of completers and see if it helps.

Yes, that works perfectly. Although

* I cannot see where I am "using special completion functions, i.e.
commands other than the standard completion system"

* I don't use any other key to generate any completion except the
Tab-key

* My matcher list[1] should work that way (because of the "+") that
even on the second try when case-insensitive and partial-word
completion didn't generate matches, substring completion uses the
other ones ("case-insensitive and partial-word"), too. So the matches
could (in theory) never decrease only increase.


Thorsten

[1]
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z} m:[-._]=[-._] r:|[-./_]=** r:|=*' '+l:|=*'


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: completion not inserting matches
  2004-04-19 15:40   ` Thorsten Kampe
@ 2004-04-20  4:23     ` Bart Schaefer
  0 siblings, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 2004-04-20  4:23 UTC (permalink / raw)
  To: zsh-users

On Apr 19,  5:40pm, Thorsten Kampe wrote:
}
} These "ascii art borders" are "box quotes" and supposed to make the
} quoted text more readable and structured

Well, yes.  If all one could do with the quoted section was read it,
they'd be fine.

  [I wrote]:
} > I do notice that you're not using the _oldlist completer.  You might try
} > adding that to the front of your list of completers and see if it helps.
} 
} Yes, that works perfectly. Although
} 
} * I cannot see where I am "using special completion functions, i.e.
} commands other than the standard completion system"

You aren't; the completion system is confusing itself somehow, and the
effect of _oldlist is to fool it back into doing what it should have.
 
} * My matcher list[1] should work that way (because of the "+")

I don't know if you read zsh-workers ... but someone else reported a
crash with a matcher-list similar to yours, so it may be that you're
tickling a bug and it's a freak of your environment that zsh goes on
working anyway (or a freak of his that it crashes, who knows).


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-04-20  4:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-18 14:17 completion not inserting matches Thorsten Kampe
2004-04-18 23:20 ` Bart Schaefer
2004-04-19 15:40   ` Thorsten Kampe
2004-04-20  4:23     ` Bart Schaefer
2004-04-18 23:35 ` Bart Schaefer
2004-04-19 14:42   ` Thorsten Kampe

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).