zsh-users
 help / color / mirror / code / Atom feed
* Case-insensitive completion of files with matcher-list
@ 2002-04-15 18:22 Hannu Koivisto
  2002-04-15 20:19 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Hannu Koivisto @ 2002-04-15 18:22 UTC (permalink / raw)
  To: Zsh Users' List

Greetings,

After reading the manual and the user's guide, I found that in
order to get case-insensitive completion everywhere, one would use:

zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'

That works fine indeed, but what if I want case-insensitive
completion only for files?  After reading about contexts and
fiddling with C-x h, I figured that

zstyle ':completion:*:all-files' matcher-list 'm:{a-zA-Z}={A-Za-z}'

should do the trick for at least echo and some other general cases
(but not for example cvs), but that does not seem to affect
anything; if I have file ChangeLog in the current directory and I
say `echo cha<tab>', I don't get `echo ChangeLog'.

Then again, the more I look at output of C-x h for various
commands, I think I don't want to alter matcher-list for all-files
tag even if it worked but for all stuff that _files function
handles.  Perhaps.

In any case, how would I get matcher-list working with contexts
that specify a tag or with a function such as _files that is used
to generate completions in a specific context?

-- 
Hannu
Please don't send copies of list mail


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

* Re: Case-insensitive completion of files with matcher-list
  2002-04-15 18:22 Case-insensitive completion of files with matcher-list Hannu Koivisto
@ 2002-04-15 20:19 ` Bart Schaefer
  2002-04-16  8:25   ` Sven Wischnowsky
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2002-04-15 20:19 UTC (permalink / raw)
  To: Hannu Koivisto; +Cc: Zsh Users' List

On Mon, 15 Apr 2002, Hannu Koivisto wrote:

> zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
>
> That works fine indeed, but what if I want case-insensitive
> completion only for files?  After reading about contexts and
> fiddling with C-x h, I figured that
>
> zstyle ':completion:*:all-files' matcher-list 'm:{a-zA-Z}={A-Za-z}'
>
> should do the trick

You're not quite right.  matcher-list is used only at the global level,
not for individual tags like all-files.  For an individual tag, you want
to use just the 'matcher' style:

 zstyle ':completion:*:all-files' matcher 'm:{a-zA-Z}={A-Za-z}'

Unfortunately, there appears to be a bug in _path_files -- it copies any
global matcher from matcher-list through to the call to compfiles, but it
doesn't do the same for a matcher passed to it with the -M option (which
is where the string from the matcher style ends up).

Unfortunately I don't see offhand how to fix this.  Sven?


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

* Re: Case-insensitive completion of files with matcher-list
  2002-04-15 20:19 ` Bart Schaefer
@ 2002-04-16  8:25   ` Sven Wischnowsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 2002-04-16  8:25 UTC (permalink / raw)
  To: zsh-users


Bart Schaefer wrote:

> On Mon, 15 Apr 2002, Hannu Koivisto wrote:
> 
> > zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
> >
> > That works fine indeed, but what if I want case-insensitive
> > completion only for files?  After reading about contexts and
> > fiddling with C-x h, I figured that
> >
> > zstyle ':completion:*:all-files' matcher-list 'm:{a-zA-Z}={A-Za-z}'
> >
> > should do the trick
> 
> You're not quite right.  matcher-list is used only at the global level,
> not for individual tags like all-files.  For an individual tag, you want
> to use just the 'matcher' style:
> 
>  zstyle ':completion:*:all-files' matcher 'm:{a-zA-Z}={A-Za-z}'
> 
> Unfortunately, there appears to be a bug in _path_files -- it copies any
> global matcher from matcher-list through to the call to compfiles, but it
> doesn't do the same for a matcher passed to it with the -M option (which
> is where the string from the matcher style ends up).
> 
> Unfortunately I don't see offhand how to fix this.  Sven?

It's collected in $matcher and I really think it was an oversight.
Sorry for this (and for sending a patch to -users).

Also note that one might want to include the other file-tags in this
case, e.g.: `:completion:*:(direcories|((all-|globbed-|)files))'.


Bye
  Sven

Index: Completion/Unix/Type/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v
retrieving revision 1.14
diff -u -r1.14 _path_files
--- Completion/Unix/Type/_path_files	17 Oct 2001 13:29:21 -0000	1.14
+++ Completion/Unix/Type/_path_files	16 Apr 2002 08:24:00 -0000
@@ -335,11 +335,11 @@
     tmp2=( "$tmp1[@]" )
 
     if [[ "$tpre$tsuf" = */* ]]; then
-      compfiles -P$cfopt tmp1 accex "$skipped" "$_matcher" "$sdirs" fake
+      compfiles -P$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" "$sdirs" fake
     elif [[ "$sopt" = *[/f]* ]]; then
-      compfiles -p$cfopt tmp1 accex "$skipped" "$_matcher" "$sdirs" fake "$pats[@]"
+      compfiles -p$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" "$sdirs" fake "$pats[@]"
     else
-      compfiles -p$cfopt tmp1 accex "$skipped" "$_matcher" '' fake "$pats[@]"
+      compfiles -p$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" '' fake "$pats[@]"
     fi
     tmp1=( $~tmp1 )
 

-- 
Sven Wischnowsky                          wischnow@berkom.de


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

end of thread, other threads:[~2002-04-16  8:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-15 18:22 Case-insensitive completion of files with matcher-list Hannu Koivisto
2002-04-15 20:19 ` Bart Schaefer
2002-04-16  8:25   ` Sven Wischnowsky

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).