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

Re: PATCH: Re: Standard setopts for completion system, again



Bart Schaefer wrote:

> ...
> 
> Another choice (still in compinit) would be simply to stuff the desired
> options into an array:
> 
> _comp_setopts=(nullglob rcexpandparam extendedglob unset
>      no{markdirs,globsubst,shwordsplit,shglob,ksharrays,cshnullglob})
> 
> and then reference them:
> 
> setopt localoptions $_comp_setopts
> 
> I guess I slightly prefer the latter, since we're already cluttering the
> parameter space with completion stuff and I'd rather stay out of the alias
> space, but either one would be OK.

Here is the patch for it (committed soon). I hope nobody objects to me 
naming the array `_comp_options'?

I've also initialised that array in what I hope is a more readable form.

Bye
 Sven

Index: Completion/Commands/_bash_completions
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Commands/_bash_completions,v
retrieving revision 1.7
diff -u -r1.7 _bash_completions
--- Completion/Commands/_bash_completions	2000/10/06 05:18:25	1.7
+++ Completion/Commands/_bash_completions	2000/10/19 08:55:42
@@ -25,8 +25,7 @@
 # that will not have been overridden, so you should add '~' to the
 # list of keys at the top of the for-loop.
 
-setopt localoptions nullglob rcexpandparam extendedglob unset
-unsetopt markdirs globsubst shwordsplit shglob ksharrays cshnullglob
+setopt localoptions $_comp_options
 
 local key=$KEYS[-1] expl
 
Index: Completion/Commands/_complete_debug
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Commands/_complete_debug,v
retrieving revision 1.10
diff -u -r1.10 _complete_debug
--- Completion/Commands/_complete_debug	2000/10/06 05:18:25	1.10
+++ Completion/Commands/_complete_debug	2000/10/19 08:55:42
@@ -1,7 +1,6 @@
 #compdef -k complete-word \C-x?
 
-setopt localoptions nullglob rcexpandparam extendedglob unset
-unsetopt markdirs globsubst shwordsplit shglob ksharrays cshnullglob
+setopt localoptions $_comp_options
 
 setopt localtraps noerrexit ; trap - ZERR
 
Index: Completion/Commands/_complete_help
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Commands/_complete_help,v
retrieving revision 1.10
diff -u -r1.10 _complete_help
--- Completion/Commands/_complete_help	2000/10/06 05:18:25	1.10
+++ Completion/Commands/_complete_help	2000/10/19 08:55:43
@@ -1,8 +1,8 @@
 #compdef -k complete-word \C-xh
 
 _complete_help() {
-  setopt localoptions nullglob rcexpandparam extendedglob unset
-  unsetopt markdirs globsubst shwordsplit shglob ksharrays cshnullglob
+  setopt localoptions $_comp_options
+
   exec </dev/null	# ZLE closes stdin, which can cause errors
 
   local _sort_tags=_help_sort_tags text i j k
Index: Completion/Commands/_correct_word
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Commands/_correct_word,v
retrieving revision 1.4
diff -u -r1.4 _correct_word
--- Completion/Commands/_correct_word	2000/10/06 05:18:25	1.4
+++ Completion/Commands/_correct_word	2000/10/19 08:55:43
@@ -7,8 +7,7 @@
 # If configurations keys with the prefix `correctword_' are
 # given they override those starting with `correct_'.
 
-setopt localoptions nullglob rcexpandparam extendedglob unset
-unsetopt markdirs globsubst shwordsplit shglob ksharrays cshnullglob
+setopt localoptions $_comp_options
 
 local curcontext="$curcontext"
 
Index: Completion/Commands/_expand_word
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Commands/_expand_word,v
retrieving revision 1.7
diff -u -r1.7 _expand_word
--- Completion/Commands/_expand_word	2000/10/11 12:19:24	1.7
+++ Completion/Commands/_expand_word	2000/10/19 08:55:43
@@ -2,8 +2,7 @@
 
 # Simple completion front-end implementing expansion.
 
-setopt localoptions nullglob rcexpandparam extendedglob unset
-unsetopt markdirs globsubst shwordsplit shglob ksharrays cshnullglob
+setopt localoptions $_comp_options
 
 local curcontext="$curcontext"
 
Index: Completion/Commands/_history_complete_word
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Commands/_history_complete_word,v
retrieving revision 1.8
diff -u -r1.8 _history_complete_word
--- Completion/Commands/_history_complete_word	2000/10/06 05:18:25	1.8
+++ Completion/Commands/_history_complete_word	2000/10/19 08:55:43
@@ -16,8 +16,7 @@
 #   range -- range of history words to complete
 
 _history_complete_word () {
-  setopt localoptions nullglob rcexpandparam extendedglob unset
-  unsetopt markdirs globsubst shwordsplit shglob ksharrays cshnullglob
+  setopt localoptions $_comp_options
 
   local expl direction stop curcontext="$curcontext"
   local max slice hmax=$#historywords
Index: Completion/Commands/_next_tags
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Commands/_next_tags,v
retrieving revision 1.10
diff -u -r1.10 _next_tags
--- Completion/Commands/_next_tags	2000/10/06 05:18:25	1.10
+++ Completion/Commands/_next_tags	2000/10/19 08:55:43
@@ -3,8 +3,7 @@
 # Main widget.
 
 _next_tags() {
-  setopt localoptions nullglob rcexpandparam extendedglob unset
-  unsetopt markdirs globsubst shwordsplit shglob ksharrays cshnullglob
+  setopt localoptions $_comp_options
 
   local ins ops="$PREFIX$SUFFIX"
 
Index: Completion/Core/_main_complete
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_main_complete,v
retrieving revision 1.42
diff -u -r1.42 _main_complete
--- Completion/Core/_main_complete	2000/10/06 05:18:25	1.42
+++ Completion/Core/_main_complete	2000/10/19 08:55:43
@@ -16,8 +16,8 @@
 # which makes the output of setopt and unsetopt reflect a different
 # state than the global one for which you are completing.
 
-setopt localoptions nullglob rcexpandparam extendedglob unset
-unsetopt markdirs globsubst shwordsplit shglob ksharrays cshnullglob
+setopt localoptions $_comp_options
+
 exec </dev/null	# ZLE closes stdin, which can cause errors
 
 # Failed returns from this code are not real errors
Index: Completion/Core/compinit
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/compinit,v
retrieving revision 1.10
diff -u -r1.10 compinit
--- Completion/Core/compinit	2000/07/26 08:54:58	1.10
+++ Completion/Core/compinit	2000/10/19 08:55:43
@@ -120,6 +120,21 @@
   _comp_dumpfile="${ZDOTDIR:-$HOME}/.zcompdump"
 fi
 
+# The standard options set in completion functions.
+
+_comp_options=(
+       nullglob
+       rcexpandparam
+       extendedglob
+       unset
+    NO_markdirs
+    NO_globsubst
+    NO_shwordsplit
+    NO_shglob
+    NO_ksharrays
+    NO_cshnullglob
+)
+
 # These can hold names of functions that are to be called before/after all
 # matches have been generated.
 

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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