summary refs log tree commit diff
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2011-05-27 14:36:33 +0000
committerMikael Magnusson <mikachu@gmail.com>2011-05-27 14:36:33 +0000
commit3214cf0a74976e8b8d2b5dc1013666d7b9b95a9a (patch)
tree1ce0fe48b926c483fd119931be12e1b0dc3d2faa
parent2b2ad86b137b2fbcd5fe8456fb128607bbe3c7e6 (diff)
downloadzsh-3214cf0a74976e8b8d2b5dc1013666d7b9b95a9a.tar.gz
zsh-3214cf0a74976e8b8d2b5dc1013666d7b9b95a9a.tar.xz
zsh-3214cf0a74976e8b8d2b5dc1013666d7b9b95a9a.zip
29384: Add _comp_caller_options
-rw-r--r--ChangeLog8
-rw-r--r--Completion/Base/Completer/_expand2
-rw-r--r--Completion/Unix/Type/_have_glob_qual4
-rw-r--r--Completion/Unix/Type/_path_files2
-rw-r--r--Completion/compinit4
5 files changed, 14 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 5f988fa85..4acbd582c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,12 @@
 	* 28364: Doc/Zsh/zle.yo: Document that space left by wrapping
 	double-width characters is highlighted with the 'special' style.
 
+	* 29384: Completion/Base/Completer/_expand,
+	Completion/Unix/Type/_have_glob_qual,
+	Completion/Unix/Type/_path_files, Completion/compinit: Add
+	_comp_caller_options and use it in completions that want to
+	check values of options that are overwritten by _comp_options.
+
 2011-05-27  Barton E. Schaefer  <schaefer@zsh.org>
 
 	* 29382: Src/Modules/curses.c: apply 29374 to zccmd_input too.
@@ -14852,5 +14858,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5338 $
+* $Revision: 1.5339 $
 *****************************************************
diff --git a/Completion/Base/Completer/_expand b/Completion/Base/Completer/_expand
index 89cc969c5..44954a2a8 100644
--- a/Completion/Base/Completer/_expand
+++ b/Completion/Base/Completer/_expand
@@ -70,7 +70,7 @@ if [[ "$force" = *s* ]] ||
 ###  parameter expressions such as ${foo} be expanded like brace
 ###  expansions, too (and with braceccl set...).
 
-   if [[ ! -o ignorebraces && "${#${exp}//[^\{]}" = "${#${exp}//[^\}]}" ]]; then
+   if [[ ! $_comp_caller_options[ignorebraces] == on && "${#${exp}//[^\{]}" = "${#${exp}//[^\}]}" ]]; then
      local otmp
 
      tmp=${(q)word}
diff --git a/Completion/Unix/Type/_have_glob_qual b/Completion/Unix/Type/_have_glob_qual
index d174406df..7b558bfd5 100644
--- a/Completion/Unix/Type/_have_glob_qual
+++ b/Completion/Unix/Type/_have_glob_qual
@@ -16,9 +16,9 @@ local complete
 [[ $2 = complete ]] && complete=")"
 
 [[ -z $compstate[quote] &&
-  ( -o bareglobqual &&
+  ( $_comp_caller_options[bareglobqual] == on &&
        $1 = (#b)(((*[^\\\$]|)(\\\\)#)\()([^\)\|\~]#)$complete &&
        ${#match[1]} -gt 1 ||
-     -o extendedglob &&
+     $_comp_caller_options[extendedglob] == on &&
        $1 = (#b)(((*[^\\\$]|)(\\\\)#)"(#q")([^\)]#)$complete
     ) ]]
diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files
index 1c272baba..858fe3f74 100644
--- a/Completion/Unix/Type/_path_files
+++ b/Completion/Unix/Type/_path_files
@@ -16,7 +16,7 @@ local -a match mbegin mend
 # The later test looks for an outstanding quote.
 if _have_glob_qual $PREFIX; then
    compset -p ${#match[1]}
-   if [[ -o extendedglob ]] && compset -P '\#'; then
+   if [[ $_comp_caller_options[extendedglob] == on ]] && compset -P '\#'; then
      _globflags
    else
      _globquals
diff --git a/Completion/compinit b/Completion/compinit
index d3c5e28b5..a0f2348a9 100644
--- a/Completion/compinit
+++ b/Completion/compinit
@@ -160,7 +160,9 @@ _comp_options=(
 # have a valid stdin descriptor (zle closes it before calling widgets)
 # and don't get confused by user's ZERR trap handlers.
 
-typeset -g _comp_setup='setopt localoptions localtraps ${_comp_options[@]};
+typeset -g _comp_setup='local -A _comp_caller_options;
+             _comp_caller_options=(${(kv)options});
+             setopt localoptions localtraps ${_comp_options[@]};
              local IFS=$'\'\ \\t\\r\\n\\0\''
              exec </dev/null;
              trap - ZERR