Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: 3.1.7-pre-1: fignore is mishandled by _files



Bart Schaefer wrote:

> On Apr 25,  1:03pm, Sven Wischnowsky wrote:
> } Subject: Re: 3.1.7-pre-1: fignore is mishandled by _files
> }
> } > _path_files attempts to use $fignore, but only if no -g options were passed.
> } > However, _files *always* passes a -g option to _path_files, so in the one
> } > case where one might expect fignore to work without extra configuration --
> } > default file completions -- it fails to do so.
> } 
> } But it explicitly uses $fignore when the pattern is `*'. And it works
> } for me with `zsh -f', setting $fignore and doing `ls <TAB>'.
> } 
> } Could you give me an example where it fails to do what you want?
> 
> It's apparently this style that's causing me trouble:
> 
>     zstyle ':completion:*' file-sort modification reverse
> 
> If _path_files is going to check for a pattern of `*', it needs to do so
> with any globbing flags first stripped off.  Ouch.

Ouch indeed. Better move that fignore test before the file-sort code.

Bye
 Sven

Index: Completion/Core/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_path_files,v
retrieving revision 1.9
diff -u -r1.9 _path_files
--- Completion/Core/_path_files	2000/04/18 15:09:40	1.9
+++ Completion/Core/_path_files	2000/04/26 06:08:28
@@ -86,6 +86,19 @@
   mopts=( "$mopts[@]" "$expl[@]" )
 fi
 
+# If given no `-F' option, we may want to use $fignore, turned into patterns.
+
+[[ -z "$_comp_no_ignore" && $#ignore -eq 0 &&
+   ( -z $gopt || "$pats" = \ #\*\ # ) && -n $FIGNORE ]] && 
+    ignore=( "?*${^fignore[@]}" )
+
+if (( $#ignore )); then
+  _comp_ignore=( "$_comp_ignore[@]" "$ignore[@]" )
+  (( $mopts[(I)-F] )) || mopts=( "$mopts[@]" -F _comp_ignore )
+fi
+
+(( $#matcher )) && mopts=( "$mopts[@]" "$matcher[@]" )
+
 if zstyle -s ":completion:${curcontext}:files" file-sort tmp1; then
   case "$tmp1" in
   *size*)             sort=oL;;
@@ -139,19 +152,6 @@
 [[ $compstate[insert] = (*menu|[0-9]*) || -n "$_comp_correct" ||
    ( -n "$compstate[pattern_match]" &&
      "${orig#\~}" != "${${orig#\~}:q}" ) ]] && menu=yes
-
-# If given no `-F' option, we may want to use $fignore, turned into patterns.
-
-[[ -z "$_comp_no_ignore" && $#ignore -eq 0 &&
-   ( -z $gopt || "$pats" = \ #\*\ # ) && -n $FIGNORE ]] && 
-    ignore=( "?*${^fignore[@]}" )
-
-if (( $#ignore )); then
-  _comp_ignore=( "$_comp_ignore[@]" "$ignore[@]" )
-  (( $mopts[(I)-F] )) || mopts=( "$mopts[@]" -F _comp_ignore )
-fi
-
-(( $#matcher )) && mopts=( "$mopts[@]" "$matcher[@]" )
 
 # Now let's have a closer look at the string to complete.
 

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author