summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Commands/_expand_word11
-rw-r--r--Completion/Core/_expand1
-rw-r--r--Doc/Zsh/compsys.yo16
4 files changed, 27 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 03a91ca7d..acb35ef81 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-09-20  Bart Schaefer  <schaefer@zsh.org>
+
+	* 12851, 12852: Completion/Commands/_expand_word,
+	Completion/Core/_expand, Doc/Zsh/compsys.yo: Change the way the
+	completers are selected for _expand_word; clarify and update doc.
+
 2000-09-20  Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru>
 
 	* 12848: Doc/Zsh/zle.yo: Alphabetize list of parameters
diff --git a/Completion/Commands/_expand_word b/Completion/Commands/_expand_word
index fddd065ee..4ff24c3f5 100644
--- a/Completion/Commands/_expand_word
+++ b/Completion/Commands/_expand_word
@@ -6,6 +6,7 @@ setopt localoptions nullglob rcexpandparam extendedglob noshglob
 unsetopt markdirs globsubst shwordsplit nounset ksharrays
 
 local curcontext="$curcontext"
+local -ah completers
 
 if [[ -z "$curcontext" ]]; then
   curcontext="expand-word:::"
@@ -13,4 +14,12 @@ else
   curcontext="expand-word:${curcontext#*:}"
 fi
 
-_main_complete _expand
+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
diff --git a/Completion/Core/_expand b/Completion/Core/_expand
index 9e7d3d122..d47251c5a 100644
--- a/Completion/Core/_expand
+++ b/Completion/Core/_expand
@@ -23,7 +23,6 @@ local exp word sort expr expl subd suf=" " force opt asp tmp opre pre epre
 if [[ "$force" = *c* ]] ||
    zstyle -t ":completion:${curcontext}:" completions; then
   compstate[insert]=all
-  [[ "$curcontext" = expand-word:* ]] && _complete && return 0
   return 1
 fi
 
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index bd34e0674..6715c091f 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -971,7 +971,8 @@ item(tt(completions))(
 This style is used by the tt(_expand) completer function. If it is set 
 to `true', the completer will not generate expansions, but instead the
 completions will be generated as normal and all of them will be
-inserted into the command line.
+inserted into the command line.  This style is most useful when set
+only for very specific completion contexts.
 )
 kindex(condition, completion style)
 item(tt(condition))(
@@ -2302,10 +2303,9 @@ string from the line.
 Which kind of expansion is tried is controlled by the tt(substitute),
 tt(glob) and tt(subst-globs-only) styles.
 
-There is another style, tt(completions), which allows tt(_expand) to
-display or insert all em(completions) generated for the string.  The use of
-this is that the tags tt(expansions) and tt(all-expansions) are available,
-unlike with tt(_complete).
+There is another style, tt(completions), which causes tt(_expand) to
+unconditionally insert all em(completions) generated for the current
+word (even if the word is empty).
 
 When tt(_expand) is called as a function, the different modes may be
 selected with options.  The tt(-c) corresponds to the tt(completions)
@@ -2486,6 +2486,12 @@ 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)'.
+
+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))(