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

_generic and nounset option



If the nounset option is set, the following error occurs when _generic
is used:

_generic:3: curcontext: parameter not set

This is because _generic runs before options are setup in
_main_complete. A wrapper script might setup some initial context so
the patch I'm suggesting below is to use ${curcontext:-} instead of
making it ignore any existing $curcontext.

I can't help wondering if it would have been better is nounset was set
globally for completion functions though because it might help avoid
bugs.

Oliver

Index: Completion/Base/Widget/_generic
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Widget/_generic,v
retrieving revision 1.1
diff -u -r1.1 _generic
--- Completion/Base/Widget/_generic	2 Apr 2001 11:16:02 -0000	1.1
+++ Completion/Base/Widget/_generic	9 Feb 2004 21:11:20 -0000
@@ -1,6 +1,6 @@
 #autoload
 
-local curcontext="$curcontext"
+local curcontext="${curcontext:-}"
 
 if [[ -z "$curcontext" ]]; then
   curcontext="${WIDGET}:::"



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