From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23797 invoked by alias); 27 Oct 2010 10:49:52 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28375 Received: (qmail 25686 invoked from network); 27 Oct 2010 10:49:40 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Wed, 27 Oct 2010 11:48:40 +0100 From: Peter Stephenson To: Mikael Auno , zsh-workers@zsh.org Subject: Re: Prefixed backslash removed when completing command Message-ID: <20101027114840.2e586852@pwslap01u.europe.root.pri> In-Reply-To: <4CC801C1.1020109@kth.se> References: <4BF51CF3.8010609@kth.se> <4CC7EB88.8020105@kth.se> <20101027110240.16941d1f@pwslap01u.europe.root.pri> <4CC801C1.1020109@kth.se> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.6 (GTK+ 2.18.9; i686-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 27 Oct 2010 10:48:41.0310 (UTC) FILETIME=[84D9D7E0:01CB75C4] X-Scanned-By: MailControl A-06-00-00 (www.mailcontrol.com) on 10.71.1.124 On Wed, 27 Oct 2010 12:41:05 +0200 Mikael Auno wrote: > You are completely correct. I misunderstood your reply as I did not > know that the backslash was at all related to quoting or that > ordinary quoting had the same result as prefixing a command with a > backslash with respect to suppressing alias expansion. The manual currently just gives the one example which, given your experience, is probably not very helpful. Index: Doc/Zsh/grammar.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/grammar.yo,v retrieving revision 1.18 diff -p -u -r1.18 grammar.yo --- Doc/Zsh/grammar.yo 3 Feb 2010 18:36:57 -0000 1.18 +++ Doc/Zsh/grammar.yo 27 Oct 2010 10:47:09 -0000 @@ -477,12 +477,15 @@ cindex(aliases, global) An alias is defined using the tt(alias) builtin; global aliases may be defined using the tt(-g) option to that builtin. -Alias expansion is done on the shell input before any -other expansion except history expansion. Therefore, -if an alias is defined for the word tt(foo), alias expansion -may be avoided by quoting part of the word, e.g. tt(\foo). -But there is nothing to prevent an alias being defined -for tt(\foo) as well. +Alias expansion is done on the shell input before any other expansion +except history expansion. Therefore, if an alias is defined for the +word tt(foo), alias expansion may be avoided by quoting part of the +word, e.g. tt(\foo). But there is nothing to prevent an alias being +defined for tt(\foo) as well. For use with completion, which would +remove an initial backslash following by a character that isn't special, +it may be more convenient to quote the word by starting with a single +quote, i.e. tt('foo); completion will automatically add the trailing +single quote. There is a commonly encountered problem with aliases illustrated by the following code: -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom