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

Standard setopts for completion system, again



> I've suggested before that we should have one ... function? alias? ...
> that installs the "standard completion-system setopts" so that we don't
> have to remember to edit all these different places.

As I noted once before, the problem with having this be a function is that
said function must unset localoptions, which means that the caller has to
remember to set localoptions again.

Grepping through the completion functions for `setopt', I find that I have
some questions ....

Builtins/_cd:14:setopt localoptions nonomatch
Builtins/_popd:8:setopt extendedglob nonomatch
  Given these functions explicitly setopt nonomatch, does that mean that
  they intend patterns that don't match to remain unchanged?  If that's
  the case, then they should also unsetopt nullglob.

Commands/_read_comp:26:setopt localoptions extendedglob nobadpattern # xtrace promptsubst
  It looks like this function could use a few more of the standard setopts
  than it has, especially ksharrays, but I wanted to double-check.

Core/_expand:10:setopt localoptions nullglob nonomatch
  Hmm, is it necessary to set both nullglob and nonomatch?  Nullglob will
  make the patterns vanish before nomatch has a chance to complain.  And
  this function ought either to get the rest of the standard setopts if it
  is meant to be called independent of _main_complete, or else it doesn't
  need any setopts at all.

Core/_path_files:13:setopt localoptions nullglob rcexpandparam
Core/_path_files:14:unsetopt markdirs globsubst shwordsplit nounset
User/_mailboxes:70:  setopt localoptions nullglob
User/_man:3:setopt localoptions rcexpandparam
User/_perl_modules:49:        setopt localoptions extendedglob
  Other cases where either all or none of the standard options seems to be
  the right thing.  Am I missing something?

Here's a patch for the places where it's obvious cshnullglob needs to be
unset.

I changed Sven's `no*' forms back into an unsetopt in _main_complete; I
don't think it's significantly faster to use one command instead of two,
and it's much easier to read without all those repeated `no's.

diff -ru common/Completion/Commands/_bash_completions current/Completion/Commands/_bash_completions
--- Completion/Commands/_bash_completions	Fri Aug 11 09:46:20 2000
+++ Completion/Commands/_bash_completions	Thu Oct  5 21:56:22 2000
@@ -25,8 +25,8 @@
 # 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 noshglob
-unsetopt markdirs globsubst shwordsplit nounset ksharrays
+setopt localoptions nullglob rcexpandparam extendedglob unset
+unsetopt markdirs globsubst shwordsplit shglob ksharrays cshnullglob
 
 local key=$KEYS[-1] expl
 
diff -ru common/Completion/Commands/_complete_debug current/Completion/Commands/_complete_debug
--- Completion/Commands/_complete_debug	Fri Sep 15 08:25:26 2000
+++ Completion/Commands/_complete_debug	Thu Oct  5 21:56:22 2000
@@ -1,7 +1,7 @@
 #compdef -k complete-word \C-x?
 
-setopt localoptions nullglob rcexpandparam extendedglob noshglob
-unsetopt markdirs globsubst shwordsplit nounset ksharrays
+setopt localoptions nullglob rcexpandparam extendedglob unset
+unsetopt markdirs globsubst shwordsplit shglob ksharrays cshnullglob
 
 setopt localtraps noerrexit ; trap - ZERR
 
diff -ru common/Completion/Commands/_complete_help current/Completion/Commands/_complete_help
--- Completion/Commands/_complete_help	Thu Aug  3 07:46:42 2000
+++ Completion/Commands/_complete_help	Thu Oct  5 21:56:22 2000
@@ -1,8 +1,8 @@
 #compdef -k complete-word \C-xh
 
 _complete_help() {
-  setopt localoptions nullglob rcexpandparam extendedglob noshglob
-  unsetopt markdirs globsubst shwordsplit nounset ksharrays
+  setopt localoptions nullglob rcexpandparam extendedglob unset
+  unsetopt markdirs globsubst shwordsplit shglob ksharrays cshnullglob
   exec </dev/null	# ZLE closes stdin, which can cause errors
 
   local _sort_tags=_help_sort_tags text i j k
diff -ru common/Completion/Commands/_correct_word current/Completion/Commands/_correct_word
--- Completion/Commands/_correct_word	Thu Aug  3 07:46:42 2000
+++ Completion/Commands/_correct_word	Thu Oct  5 21:56:22 2000
@@ -7,8 +7,8 @@
 # If configurations keys with the prefix `correctword_' are
 # given they override those starting with `correct_'.
 
-setopt localoptions nullglob rcexpandparam extendedglob noshglob
-unsetopt markdirs globsubst shwordsplit nounset ksharrays
+setopt localoptions nullglob rcexpandparam extendedglob unset
+unsetopt markdirs globsubst shwordsplit shglob ksharrays cshnullglob
 
 local curcontext="$curcontext"
 
diff -ru common/Completion/Commands/_expand_word current/Completion/Commands/_expand_word
--- Completion/Commands/_expand_word	Thu Sep 21 23:47:13 2000
+++ Completion/Commands/_expand_word	Thu Oct  5 21:56:22 2000
@@ -2,8 +2,8 @@
 
 # Simple completion front-end implementing expansion.
 
-setopt localoptions nullglob rcexpandparam extendedglob noshglob
-unsetopt markdirs globsubst shwordsplit nounset ksharrays
+setopt localoptions nullglob rcexpandparam extendedglob unset
+unsetopt markdirs globsubst shwordsplit shglob ksharrays cshnullglob
 
 local curcontext="$curcontext"
 local -ah completers
diff -ru common/Completion/Commands/_history_complete_word current/Completion/Commands/_history_complete_word
--- Completion/Commands/_history_complete_word	Thu Aug  3 07:46:42 2000
+++ Completion/Commands/_history_complete_word	Thu Oct  5 21:56:22 2000
@@ -16,8 +16,8 @@
 #   range -- range of history words to complete
 
 _history_complete_word () {
-  setopt localoptions nullglob rcexpandparam extendedglob noshglob
-  unsetopt markdirs globsubst shwordsplit nounset ksharrays
+  setopt localoptions nullglob rcexpandparam extendedglob unset
+  unsetopt markdirs globsubst shwordsplit shglob ksharrays cshnullglob
 
   local expl direction stop curcontext="$curcontext"
   local max slice hmax=$#historywords
diff -ru common/Completion/Commands/_next_tags current/Completion/Commands/_next_tags
--- Completion/Commands/_next_tags	Thu Aug  3 07:46:42 2000
+++ Completion/Commands/_next_tags	Thu Oct  5 21:56:22 2000
@@ -3,8 +3,8 @@
 # Main widget.
 
 _next_tags() {
-  setopt localoptions nullglob rcexpandparam extendedglob noshglob
-  unsetopt markdirs globsubst shwordsplit nounset ksharrays
+  setopt localoptions nullglob rcexpandparam extendedglob unset
+  unsetopt markdirs globsubst shwordsplit shglob ksharrays cshnullglob
 
   local ins ops="$PREFIX$SUFFIX"
 
diff -ru common/Completion/Core/_main_complete current/Completion/Core/_main_complete
--- Completion/Core/_main_complete	Thu Oct  5 10:06:01 2000
+++ Completion/Core/_main_complete	Thu Oct  5 22:05:24 2000
@@ -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 noshglob \
-       nomarkdirs noglobsubst noshwordsplit unset noksharrays nocshnullglob
+setopt localoptions nullglob rcexpandparam extendedglob unset
+unsetopt markdirs globsubst shwordsplit shglob ksharrays cshnullglob
 exec </dev/null	# ZLE closes stdin, which can cause errors
 
 # Failed returns from this code are not real errors

-- 
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