From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14206 invoked by alias); 24 Dec 2013 16:11:45 -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: 18249 Received: (qmail 10284 invoked from network); 24 Dec 2013 16:11:28 -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=-0.7 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_NUMERIC_HELO,SPF_HELO_PASS autolearn=no version=3.3.2 X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@zsh.org From: Yuri D'Elia Subject: Re: Expanding quotes Date: Tue, 24 Dec 2013 17:11:11 +0100 Message-ID: References: <131217102648.ZM8656@torch.brasslantern.com> <131223111515.ZM31989@torch.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 159.20.235.175 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131103 Icedove/17.0.10 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".