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

Re: WARN_CREATE_GLOBAL and url-quote-magic



On Fri, 11 Dec 2015 14:05:07 +0100
Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> I don't think that the following has been reported yet. Run "zsh -f"
> and:
> 
>   setopt WARN_CREATE_GLOBAL
>   autoload -Uz url-quote-magic
>   zle -N self-insert url-quote-magic
> 
> Then type "echo a:b ". After typing the space after "a:b", I get:
> 
> cventin% echo a:b
> url-quote-magic:12: array parameter match created globally in function url-quote-magic
> url-quote-magic:12: array parameter mbegin created globally in function url-quote-magic
> url-quote-magic:12: array parameter mend created globally in function url-quote-magic
> cventin% echo a:b 

Yes, it's the (#b) in the pattern creating those parameters.  All such
instances in distributed functions should be suitably protected.

I don't think there's any chance of needing the result in a higher scope
this time...

pws

diff --git a/Functions/Zle/url-quote-magic b/Functions/Zle/url-quote-magic
index 0e49573..7ee281e 100644
--- a/Functions/Zle/url-quote-magic
+++ b/Functions/Zle/url-quote-magic
@@ -115,7 +115,7 @@ alias globurl='noglob urlglobber '
 function url-quote-magic {
     setopt localoptions noksharrays extendedglob
     local qkey="${(q)KEYS}"
-    local -a reply
+    local -a reply match mbegin mend
     if [[ "$KEYS" != "$qkey" ]]
     then
 	local lbuf="$LBUFFER$qkey"



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