From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10980 invoked by alias); 28 Dec 2016 17:39:39 -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: 22304 Received: (qmail 26316 invoked from network); 28 Dec 2016 17:39:39 -0000 X-Qmail-Scanner-Diagnostics: from mta02.eastlink.ca by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(24.224.136.13):SA:0(-3.8/5.0):. Processed in 1.506726 secs); 28 Dec 2016 17:39:39 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-3.8 required=5.0 tests=RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RP_MATCHES_RCVD,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: rayandrews@eastlink.ca X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.eastlink.ca designates 24.224.136.13 as permitted sender) X-Authority-Analysis: v=2.2 cv=DOfN2GFb c=1 sm=1 tr=0 a=28Ntk8jg+Dho8ABWn/CRtA==:117 a=28Ntk8jg+Dho8ABWn/CRtA==:17 a=N659UExz7-8A:10 a=L2bWDaSSHyGGC5BU9m4A:9 a=pILNOxqGKmIA:10 X-EL-IP-NOAUTH: 24.207.16.108 Subject: Re: append to history entry? To: zsh-users@zsh.org References: <5288b537-f06a-d18a-60ea-1f962856c80c__41345.3811700039$1482803962$gmane$org@eastlink.ca> <20161227125530.GA4796@fujitsu.shahaf.local2> <161227080022.ZM519@torch.brasslantern.com> <99549001-5744-c36f-a4dc-404071aba08a@eastlink.ca> <161227110954.ZM1153@torch.brasslantern.com> <0a48db86-b41a-283c-8193-e2766aa5d30b@eastlink.ca> <161227155552.ZM2385@torch.brasslantern.com> <161227220458.ZM3240@torch.brasslantern.com> From: Ray Andrews Message-id: Date: Wed, 28 Dec 2016 09:39:31 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-version: 1.0 In-reply-to: <161227220458.ZM3240@torch.brasslantern.com> Content-type: text/plain; charset=windows-1252; format=flowed Content-transfer-encoding: 7bit On 27/12/16 10:04 PM, Bart Schaefer wrote: > The backslash stuff is borrowed conceptually from C (\t for tab, etc.). > Having that same paradigm applied at multiple levels of processing stems > from the language being interpreted rather than compiled. I think what I'm not really getting is the multiple level thing. When I get that, maybe difficulties will melt away. Of course the backslash is special, hasta be. > The point is that this isn't "natural," because what you asked for isn't > natural. No? It seems simple enough and the ' : ' command seems tailor made for it. > but for the > sake of everyone else who's going to see this and copy-paste, it > may be worth forestopping any future problems. Of course! It's the gotchas that drive me crazy. Un-robust code is alpha code. I guess that's one of these cultural things -- for me the idea that something more or less works most of the time, but never on Thursday, just doesn't cut it. No, I'll never have a backslash in my $HOST but that's irrelevant because it hasta be proof against that possibility. I agree with you absolutely. $HOST is an unformated literal string and should be seen that way every time. > > You can't get away from thinking about what you mean. Indeed not. The difficulty is that what I mean and what zsh thinks I mean ain't the same. I keep lusting after 'history'. Sheesh, what I want is already there, zsh already knows how to preserve the literal keystrokes that you typed into history, I just can't get at it. If I could just intercept the command as it goes into history -- but with each command knowing what belongs to itself when there are semicolons -- I'd have everything I want: $ com1 "\'"{(g+)}()\(\t | @$%^>> /dev/the-void < ; com2 "\t"; echo "don't try this at home" ... now hit the up arrow and what I get back is exactly what I typed. So why can't we have: function com1 () { echo "Here's exactly what you typed, absolutely unmolested, when you invoked this command:\n $MY-LITERAL-ARGUMENTS-AS-HISTORY-WILL-RECORD-THEM" } $ com1 "\'"{(g+)}()\(\t | @$%^>> /dev/the-void < Here's exactly what you typed, absolutely unmolested, when you invoked this command: com1 "\'"{(g+)}()\(\t | @$%^>> /dev/the-void < $ Somewhere, in the deepest bowels of the parser, the literal string exists just before it is sent to history. If I could just grab it somehow ... Don't let me bother you too much Bart, we've been over this, and it seems it can't be done. In practical terms what you've shown me works perfectly.