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

Catch URLs (was: "Literal" command execution)



Hi,

I want to reduce escaping to the bare minimum. Dollars are not really a problem, but I discovered myself to escape '<' '>' and '!' too often.
For URLs I'm using something called url-quote-magic: when I start
writing an URL, it's detected and then all special characters are
escaped (&, <, >, !).
autoload -U url-quote-magic ; zle -N self-insert url-quote-magic
This is really great for copying+pasting URLs, for example to use it in wget.

It's almost really great. :)

I have setopt warncreateglobal enabled by default because it helps me to catch global variables that should be local, especially in my own functions. Now, when I run the autoload line above and then paste an URL I am warned every time the URL is being escaped.

Try something like this to reproduce it. In this example I'll just use an arbitrary URL I happen to have on my clipboard:

setopt warncreateglobal
autoload -U url-quote-magic; zle -N self-insert url-quote-magic
curl -LO https://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git;a=blob_plain;f=queue-3.2/mm-fix-up-thp-spin_is_locked-bugs.patch;hb=50c8f68647a605333fe78c86966e802c07a105c0

output:
8 of these:
url-quote-magic:68: array parameter reply created globally in function
url-quote-magic:72: array parameter reply created globally in function

I'm not sure how to fix this, tips for that are appreciated.

Mark



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