Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] internal: quotestring: Drop the 'e' parameter, which no caller uses.



Bart Schaefer wrote on Fri, Sep 09, 2016 at 22:00:03 -0700:
> Recall what I've said in a couple of other threads about it being too
> hard for completion to intuit what a user means to have remain quoted
> and what he expects completion to expand or otherwise treat as unquoted?
> The need for this "e" argument seems to have gone away when we decided
> to give up and do minimal quote interpretation/insertion.

Somewhat related, I don't understand the purpose of tildequote().  I could
document it as follows:

/*
 * tildequote(s, ign): Equivalent to multiquote(s, ign), except that if
 * compqstack[0] == QT_BACKSLASH and s[0] == '~', then that tilde is not
 * quoted.
 */

Which I'm having trouble getting my head around: when would it be a good
idea to decide whether to quote ~ or not based on what _kind_ of quoting
the user happened to use?

Example:

     1	% _f() { compset -q; compadd -f '~/foo foo' }
     2	% compdef _f f
     3	% f \~/foo<TAB>   # becomes ~/foo\\\ foo
     4	% f '~/foo<TAB>   # becomes '~/foo\ foo

Lines 3 and 4 both start with a quoted tilde, but one of them ends with
a quoted tilde and the other with an unquoted tilde.

This seems to be an intentional feature since if tildequote() were
changed to escape the tilde even in the QT_BACKSLASH case, it would be
synonymous with multiquote().

> I don't know what this patch accomplishes other than some dead code
> removal, but I guess there's no remaining reason not to commit it.
> 

Thanks for the inestigation and patch review.

Daniel



Messages sorted by: Reverse Date, Date, Thread, Author