From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14368 invoked by alias); 13 Oct 2010 17:16:18 -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: 28349 Received: (qmail 10622 invoked from network); 13 Oct 2010 17:16:14 -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, 13 Oct 2010 17:45:13 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: print -D and ${(D)} quoting Message-ID: <20101013174513.084f0482@pwslap01u.europe.root.pri> In-Reply-To: <101013091442.ZM25227@torch.brasslantern.com> References: <4637.1286902367@csr.com> <20101012215339.26037042@pws-pc> <101012185649.ZM20220@torch.brasslantern.com> <20101013100435.4d3ae3f7@pwslap01u.europe.root.pri> <101013091442.ZM25227@torch.brasslantern.com> 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: 13 Oct 2010 16:45:13.0593 (UTC) FILETIME=[01DCAE90:01CB6AF6] X-Scanned-By: MailControl A-10-90-03 (www.mailcontrol.com) on 10.71.0.123 On Wed, 13 Oct 2010 09:14:42 -0700 Bart Schaefer wrote: > The ONLY reason I understand for using (D) is for human consumption, > e.g., for display, so from my point of view (Q) is never not required. Ah, this is probably the key point of why we're looking at this differently. No, the resulting string is used in completion. So the intention is for the munged value to be both useful and readable. The case I'm interested in (and this is actually the only time I've used the (D) flag so far, so I can't really compare with other possible uses) is: - take PWD - save the value to a file - use that value later on for completion but in the process tidy up the value to something that's more readable for the user, so doing the ~ contraction. (It doesn't really matter here whether that's at the second or third step, in fact it's at the third). One oddity here is that we're completing the full path in one go --- the choices are absolute paths which could be anywhere in the file system. This is why having a compact prefix becomes important. In this particular case it's clear cut that either I supply a raw file string, and allow completion to do the quoting, or I supply a properly quoted command line argument, and make completion insert it literally, since completion will either quote everything or nothing. So the new code gets me "~/with\ space" or whatever, and I tell completion to insert that literally. I don't necessarily know this is going to be widely used but I still don't a good example of why doing it differently is likely to be more useful. -- 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