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

Re: _complete_help vs. the matcher-list style



Bart Schaefer wrote:

> If you have a matcher-list style, using _complete_help causes any completion
> function that uses that style to be called once for each match-spec in the
> style.  (I noticed this while working on a variant of _complete_debug.)
> 
> I believe this is because _complete_help redefines compadd to always fail.

Which we need to be sure that all completers are used, of course.

> Nevertheless it's a bit of a pain, as no additional context information is
> obtained by trying the other matchers.

Hm, the easy way is to make the zstyle() function defined by
_complete_help return the empty string when used for the matcher-list
style.

But that also reminds me that I've been dreaming about support to
save/set/restore styles, for use by wrapper functions such as
_complete_help. If anyone has any ideas or suggestions for something
like that, I'd like to hear them.


Bye
 Sven

Index: Completion/Commands/_complete_help
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Commands/_complete_help,v
retrieving revision 1.4
diff -u -r1.4 _complete_help
--- Completion/Commands/_complete_help	2000/04/12 03:32:51	1.4
+++ Completion/Commands/_complete_help	2000/05/02 09:07:18
@@ -27,7 +27,14 @@
       esac
       help_styles[${2}${_f}]="${help_styles[${2}${_f}]},${_t} ${3}:${_f}"
     fi
-    builtin zstyle "$@"
+
+    # No need to call the completers more than once with different match specs.
+
+    if [[ "$3" = matcher-list ]]; then
+      eval "${4}=( '' )"
+    else
+      builtin zstyle "$@"
+    fi
   }
 
   _main_complete

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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