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

Re: PATCH: _expand, _expand_word, and their doc



On Sep 20,  5:57pm, Bart Schaefer wrote:
}
} This has the undesirable side-effect of failing to call any of the usual
} other completers such as _match (see zsh-users/3444 and its thread).  So
} I've deleted that line from _expand, and instead caused _expand_word to
} fetch the `completer' style [...]

Except I forgot that this is only supposed to happen when the completions
style is set.  Sorry about that.

Index: Completion/Commands/_expand_word
===================================================================
@@ -14,8 +14,12 @@
   curcontext="expand-word:${curcontext#*:}"
 fi
 
-zstyle -a ":completion:${curcontext}:" completer completers
-completers[1,(i)_expand]=_expand
-(( $#completers == 1 )) && completers=(_expand _complete)
+if zstyle -t ":completion:${curcontext}:" completions; then
+    zstyle -a ":completion:${curcontext}:" completer completers
+    completers[1,(i)_expand]=_expand
+    (( $#completers == 1 )) && completers=(_expand _complete)
+else
+    completers=(_expand)
+fi
 
 _main_complete $completers
Index: Doc/Zsh/compsys.yo
===================================================================
@@ -2485,11 +2485,13 @@
 item(tt(_expand_word (^Xe)))(
 Performs expansion on the current word:  equivalent to the standard
 tt(expand-word) command, but using the tt(_expand) completer.  Before
-calling it, the var(function) field is set to `tt(expand-word)', and the
-list of functions from the tt(completer) style in the resuting context is
-shifted to remove all those to the left of tt(_expand).  If tt(_expand)
-does not appear in the style, then only the two completers tt(_expand) and
-tt(_complete) are used (in that order).
+calling it, the var(function) field is set to `tt(expand-word)'.
+
+The tt(completions) style is also tested in the resulting context.  When
+it is true, the list of functions from the tt(completer) style is shifted
+to remove any that would be called ahead of tt(_expand).  If tt(_expand)
+does not appear in the tt(completer) style, then only the two completers
+tt(_expand) and tt(_complete) are used (in that order).
 )
 findex(_generic)
 item(tt(_generic))(

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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