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

Re: Catch URLs (was: "Literal" command execution)



On Sat, 31 Mar 2012 18:00:50 +0200
Mark <lists+zsh@xxxxxxxxxxxxxx> wrote:
> Hmm, I have recently upgraded zsh and although I saw your patch
> included, the error came back. Apparently I had fixed it manually.
> Please see below. I wonder whether this method is ideal for you.
> 
> Thanks,
> Mark
> 
> diff -pU1 old/url-quote-magic new/url-quote-magic 
> --- old/url-quote-magic	2012-03-31 17:58:23.646634259 +0200
> +++ new/url-quote-magic	2012-03-31 17:57:13.587013805 +0200
> @@ -68,3 +68,3 @@ zstyle -m ':url-quote-magic:\*' url-meta
>  zstyle -m ':url-quote-magic:\*' url-seps '*' ||
> -    zstyle -e ':url-quote-magic:*' url-seps 'reply=(";&<>${histchars[1]}")'
> +    zstyle -e ':url-quote-magic:*' url-seps 'local -a reply; reply=(";&<>${histchars[1]}")'
>  
> @@ -72,3 +72,3 @@ zstyle -m :url-quote-magic url-globbers
>      zstyle -e :url-quote-magic url-globbers \
> -	'zmodload -i zsh/parameter;
> +	'local -a reply; zmodload -i zsh/parameter;
>  	 reply=( noglob

I see what's happening now... there are functions defined internally,
and I only put the "local" in the function that's only run once to
define them.

Your solution's probably OK, since with the "-a" the shell doesn't print
the value after "local" the second time, as it would with "local reply;
local reply".  Still, I've kept with the spirit of what I did before...

Index: Functions/Zle/url-quote-magic
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Zle/url-quote-magic,v
retrieving revision 1.4
diff -p -u -r1.4 url-quote-magic
--- Functions/Zle/url-quote-magic	14 Feb 2012 15:33:02 -0000	1.4
+++ Functions/Zle/url-quote-magic	1 Apr 2012 17:17:21 -0000
@@ -84,7 +84,7 @@ zstyle -m ':urlglobber' url-other-schema
 # Define the "urlglobber" helper function and shorthand "globurl" alias
 
 function urlglobber {
-    local -a args globbed localschema otherschema
+    local -a args globbed localschema otherschema reply
     local arg command="$1"
     shift
     zstyle -s :urlglobber url-local-schema localschema '|'
@@ -109,6 +109,7 @@ alias globurl='noglob urlglobber '
 function url-quote-magic {
     setopt localoptions noksharrays extendedglob
     local qkey="${(q)KEYS}"
+    local -a reply
     if [[ "$KEYS" != "$qkey" ]]
     then
 	local lbuf="$LBUFFER$qkey"

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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