zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <Peter.Stephenson@csr.com>
To: zsh-workers@zsh.org
Subject: Re: print -D and ${(D)} quoting
Date: Wed, 13 Oct 2010 17:45:13 +0100	[thread overview]
Message-ID: <20101013174513.084f0482@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <101013091442.ZM25227@torch.brasslantern.com>

On Wed, 13 Oct 2010 09:14:42 -0700
Bart Schaefer <schaefer@brasslantern.com> 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 <pws@csr.com>            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


      reply	other threads:[~2010-10-13 17:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-12 16:52 Peter Stephenson
2010-10-12 20:53 ` Peter Stephenson
2010-10-13  1:56   ` Bart Schaefer
2010-10-13  9:04     ` Peter Stephenson
2010-10-13 16:14       ` Bart Schaefer
2010-10-13 16:45         ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101013174513.084f0482@pwslap01u.europe.root.pri \
    --to=peter.stephenson@csr.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).