zsh-users
 help / color / mirror / code / Atom feed
From: Yuri D'Elia <wavexx@users.sourceforge.net>
To: zsh-users@zsh.org
Subject: Re: Expanding quotes
Date: Tue, 24 Dec 2013 17:11:11 +0100	[thread overview]
Message-ID: <l9cbmk$6od$1@ger.gmane.org> (raw)
In-Reply-To: <131223111515.ZM31989@torch.brasslantern.com>

On 12/23/2013 08:15 PM, Bart Schaefer wrote:
> It's a syntactic question as well as a semantic one.  For example, you
> typed
> 
>     ls *\"
> 
> and expected completion to treat backslash-dquote as a unit matching a
> literal double quote.  But someone else might type
> 
>     ls *"
> 
> and expect completion to *supply* the missing backslash, because there
> is a file name ending with a quote.  It gets even more complicated if

I'm pretty sure I've experienced this behavior before, though it's
definitely rare.

> A third complication is that there are a huge number of different ways
> to apply quoting, and trying to figure out which one corresponds to what
> the user already typed is difficult to generalize.  The globbing code
> that generates the list of possible files returns a particular quoting
> scheme that would have to be converted to the user's arbitrary quoting.

I see.

> We'd be happy to find some more volunteers to work on the internals of
> completion to resolve more of these cases.

Thanks for the clarification, the rationale is sound for me.

Personally, I would actually prefer is there was an option in zsh to
normalize the quoting mechanism to always "double quote" the argument
instead of escaping characters (thus inserting the initial double-quote
if missing). I don't know if this would actually simplify or furthermore
complicate the expansion rules.

With complete_in_word and all the other completion switches I definitely
see the complexity of "doing the right thing" in all the cases. Though
the fact that a glob might not expand in the same way as when executed
makes a bit of uneasy feeling for me. I often use expansion to
proof-check a glob instead of executing the command twice.

Maybe there's a better way to do it that doesn't involve running "ls
glob" before "real-command glob".



  parent reply	other threads:[~2013-12-24 16:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-17 14:48 Yuri D'Elia
2013-12-17 18:26 ` Bart Schaefer
2013-12-23 17:38   ` Yuri D'Elia
2013-12-23 19:15     ` Bart Schaefer
2013-12-24 15:12       ` Ray Andrews
2013-12-24 16:24         ` Yuri D'Elia
2013-12-24 17:18           ` Ray Andrews
2013-12-26 14:50             ` Yuri D'Elia
2013-12-26 19:54               ` Ray Andrews
2013-12-24 16:11       ` Yuri D'Elia [this message]
2013-12-25  6:59         ` Bart Schaefer

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='l9cbmk$6od$1@ger.gmane.org' \
    --to=wavexx@users.sourceforge.net \
    --cc=zsh-users@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).