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

Localize MATCH, MBEGIN, etc. in _zstyle and _globquals



Hello,
I was searching for regex usage (=~) and didn't find anything meaningful (would replace with (#b) or (#m) so that e.g. default static build works fine). However found (#m) use and not defined local MATCH, MBEGIN, MEND. To not surprise user with overwriting his matching results, I've localized those parameters in two Zsh-related completions.

--  
Sebastian Gniazdowski
psprint /at/ zdharma.org
diff --git a/Completion/Zsh/Command/_zstyle b/Completion/Zsh/Command/_zstyle
index 0e82822..7db73c0 100644
--- a/Completion/Zsh/Command/_zstyle
+++ b/Completion/Zsh/Command/_zstyle
@@ -1,7 +1,8 @@
 #compdef zstyle
 
 local state context ostate line expl ctop suf
-local nm=$compstate[nmatches] taglist patterns contexts
+local nm=$compstate[nmatches] taglist patterns contexts MATCH
+integer MBEGIN MEND
 typeset -A opt_args styles
 
 _vcs_info_hooks() {
diff --git a/Completion/Zsh/Type/_globquals b/Completion/Zsh/Type/_globquals
index c855b54..915f97c 100644
--- a/Completion/Zsh/Type/_globquals
+++ b/Completion/Zsh/Type/_globquals
@@ -1,6 +1,7 @@
 #autoload
 
-local state=qual expl char delim timespec default
+local state=qual expl char delim timespec default MATCH
+integer MBEGIN MEND
 local -a alts tdisp sdisp tmatch smatch
 local -A specmap
 


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