Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] add and use _comp_original_options
- X-seq: zsh-workers 29384
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] add and use _comp_original_options
- Date: Fri, 27 May 2011 03:20:14 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:date:message-id:x-mailer; bh=Gog8pE4outJlnbjW/TV1drKO0WulES16JIQS/ot8u7g=; b=mp+0ayIy4VMxWXFJH2ZNpmS38SF3R/n4a2YB4rUOjKYSweIlj/UcyumhHpdx10rGG4 kUfACyXyLDgWtXU/5WJbihf4Z3MRGj3B/9Q0f1KbVR7mdM2qnUS9VHL2rI1iwrbYMwrM W+Ax60aAWt27b+tLWTQENdDu+ifi1KPd7LEfI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer; b=Anc6La0B/RTahA0UU3Db/F3BVynABnSyY+1pd/rPCOjp8w0W2bZSHIzqOsz91tjuvE sK3YlmR2dQu9mRlSkgaefd33fMxZhVHmxjU8Ye4D5TfC/+KNTGXQlsni5tU2tb+oZR6d CyZW0pSu+vNuZvmGtbknEEXigPw63AvxdGe+A=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
I noticed while looking at my sketchy parameter flags patch that the
"Look for glob qualifiers" below the first hunk in _path_files had [[
-o extendedglob ]] in it to only complete globflags then, but completion
code always has extendedglob set. I came up with this to work around it,
I think I caught all the places where an option overriden in _comp_options
is checked for, ie I grepped for '-o [a-z]'. Is it safe to use $options,
or do I have to check if the parameters module is available?
---
Completion/Base/Completer/_expand | 2 +-
Completion/Unix/Type/_have_glob_qual | 4 ++--
Completion/Unix/Type/_path_files | 2 +-
Completion/compinit | 4 +++-
4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/Completion/Base/Completer/_expand b/Completion/Base/Completer/_expand
index 89cc969..7f56cbc 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_original_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 d174406..851b1fb 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_original_options[bareglobqual] == on &&
$1 = (#b)(((*[^\\\$]|)(\\\\)#)\()([^\)\|\~]#)$complete &&
${#match[1]} -gt 1 ||
- -o extendedglob &&
+ $_comp_original_options[extendedglob] == on &&
$1 = (#b)(((*[^\\\$]|)(\\\\)#)"(#q")([^\)]#)$complete
) ]]
diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files
index 34d5e8d..dc80b46 100644
--- a/Completion/Unix/Type/_path_files
+++ b/Completion/Unix/Type/_path_files
@@ -21,7 +21,7 @@ fi
# 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_original_options[extendedglob] == on ]] && compset -P '\#'; then
_globflags
else
_globquals
diff --git a/Completion/compinit b/Completion/compinit
index d3c5e28..6d3d127 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_original_options;
+ _comp_original_options=(${(kv)options});
+ setopt localoptions localtraps ${_comp_options[@]};
local IFS=$'\'\ \\t\\r\\n\\0\''
exec </dev/null;
trap - ZERR
--
1.7.4-rc1
Messages sorted by:
Reverse Date,
Date,
Thread,
Author