From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3869 invoked by alias); 13 Feb 2012 12:46:24 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16759 Received: (qmail 13542 invoked from network); 13 Feb 2012 12:46:23 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,UNPARSEABLE_RELAY autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at internecto.net designates 176.9.245.29 as permitted sender) X-Virus-Scanned: Debian amavisd-new at mx1.internecto.net To: Subject: Catch URLs (was: "Literal" command execution) X-PHP-Originating-Script: 33:func.inc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 13 Feb 2012 12:38:55 +0000 From: mark+lists@internecto.net In-Reply-To: References: <20120123205150.27077e4eea9d7be1e632508f@users.sf.net> Message-ID: <35878fa4ecfd0dee27367340676d7b30@voidzero.net> X-Sender: mark+lists@internecto.net User-Agent: Roundcube Webmail/RCMAIL_VERSION 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