From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3709 invoked from network); 12 Jan 2009 04:00:27 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 12 Jan 2009 04:00:27 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 7272 invoked from network); 12 Jan 2009 04:00:22 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 12 Jan 2009 04:00:22 -0000 Received: (qmail 12408 invoked by alias); 12 Jan 2009 04:00:17 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26292 Received: (qmail 12396 invoked from network); 12 Jan 2009 04:00:17 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 12 Jan 2009 04:00:17 -0000 Received: from QMTA03.westchester.pa.mail.comcast.net (qmta03.westchester.pa.mail.comcast.net [76.96.62.32]) by bifrost.dotsrc.org (Postfix) with ESMTP id F22FD80271F0 for ; Mon, 12 Jan 2009 05:00:12 +0100 (CET) Received: from OMTA01.westchester.pa.mail.comcast.net ([76.96.62.11]) by QMTA03.westchester.pa.mail.comcast.net with comcast id 2Br41b0020EZKEL53U0CZr; Mon, 12 Jan 2009 04:00:12 +0000 Received: from smtp.klanderman.net ([98.217.254.247]) by OMTA01.westchester.pa.mail.comcast.net with comcast id 2U0C1b00S5M2Np63MU0Coj; Mon, 12 Jan 2009 04:00:12 +0000 Received: from lwm.klanderman.net (unknown [192.168.100.50]) by smtp.klanderman.net (Postfix) with ESMTP id 16D3FB30148 for ; Sun, 11 Jan 2009 23:00:11 -0500 (EST) Received: by lwm.klanderman.net (Postfix, from userid 500) id E56CC9FC5E5; Sun, 11 Jan 2009 23:00:10 -0500 (EST) From: Greg Klanderman To: zsh-workers@sunsite.dk Subject: Re: some way to inherit kill ring in su'd shell? Reply-To: gak@klanderman.net Date: Sun, 11 Jan 2009 23:00:10 -0500 In-Reply-To: <090111193317.ZM12655@torch.brasslantern.com> (Bart Schaefer's message of "Sun, 11 Jan 2009 19:33:17 -0800") Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.17 (linux) References: <18789.30656.261463.382208@gargle.gargle.HOWL> <20090110095231.GA61601@redoubt.spodhuis.org> <20090111025418.GA7272@redoubt.spodhuis.org> <090111110748.ZM12349@torch.brasslantern.com> <090111193317.ZM12655@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: ClamAV 0.92.1/8853/Mon Jan 12 01:26:44 2009 on bifrost X-Virus-Status: Clean [redirected from zsh-users] >>>>> Bart Schaefer writes: > On Jan 11, 8:58pm, Greg Klanderman wrote: > } > } Is an enhancement something like this acceptable? > } > } +tindex(zle-line-finished) > } +item(tt(zle-line-finished))( > } +This is similar to tt(zle-line-init) but is executed every time the line > } +editor is finished reading a new line of input. > } +) > In concept this is OK (though there might be a better suffix than > "-finished", maybe even just "-finish") Yep, whatever you guys like is fine by me.. > but I don't think your patch > follows through some possible ramifications. For example, it might > be preferable to save/restore errflag and retflag so that the values > from the end of zlecore() are preserved, and it's possible that the > zle-line-finish widget should not run when errflag != 0. Those sound like good things to worry about getting right. > I don't know all the ramifications of the values of various globals > at the end of zlecore(). PWS? Right, I certainly don't either.. Anyway, here's a new version of my previous code using this enhancement which also preserves the kill ring. There isn't a builtin module for base64 encoding is there? :-) function zle-encode-strings () { python -c ' import base64, sys sys.stdout.write(":".join(map(lambda v: base64.encodestring(v).replace("\n", ""), sys.argv[1:]))) ' $@ } function zle-decode-string () { python -c ' import base64, sys sys.stdout.write(base64.decodestring(sys.argv[1])) ' $1 } function zle-line-init () { local v i=0 if [[ ${ZLEKILLRINGPID-} != $$ && -n ${ZLECUTBUFFER-} ]] ; then CUTBUFFER="$(zle-decode-string $ZLECUTBUFFER)" for v in ${(s-:-)ZLEKILLRING} ; do killring[((i++))]="$(zle-decode-string $v)" done fi } zle -N zle-line-init function zle-line-finished () { export ZLEKILLRINGPID=$$ export ZLECUTBUFFER="$(zle-encode-strings $CUTBUFFER)" export ZLEKILLRING="$(zle-encode-strings $killring[@])" } zle -N zle-line-finished cheers, Greg