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

Re: append to history entry?



On 27/12/16 03:55 PM, Bart Schaefer wrote:
That's what $'...' does, but you can't ask for a C string and for
variable interpolation at the same time.  Well, you can, but it
doesn't really help. ;-)
Indeed. Be careful what you ask for ... I am expecting the variables to expand. It's all this backslash and 'is it one string or several strings' stuff. Dunno ... is that really different? It just seems that the expansion of the variables is 'visible' for lack of a better word -- you expect it, it's not a gotcha the way the rest is. For me, the task is to see the 'naturalness' for lack of a better word of the way
that zsh does this:

    print -rS -- "rap ${${(q+)@}}; : ${(q-)HOST}"

... it seems that the backslashes need protecting and reprotecting and yet more protecting and each stage of the protection is different from the last. Couldn't we just:

    setopt protect-backslashes-thanks
    print -S "rap $@; : $HOST"

... it's not that the backslashes are presumed special, it's that I'd say we should only have to press one button once to literalise them. Is it impossible that this could be simple and intuitive? No ordinary mortal would know to do what you guys showed me, one must be shown and even Bart and Daniel didn't get it exactly right the first time. What hope do I have?


Maybe this would be easier (in the "should have thought of this before"
category):

     print -s -f '%s' rap "$@" ";" ":" "$HOST"

(Note this doesn't work with -S, which currently is silently ignored if
the -f option is given, but as you already have all the words separated
here there's no reason to re-parse them.)

I'll chew on that.



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