From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25667 invoked by alias); 23 Sep 2010 10:31:33 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28285 Received: (qmail 22085 invoked from network); 23 Sep 2010 10:31:30 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Thu, 23 Sep 2010 10:40:23 +0100 From: Peter Stephenson To: zsh workers Subject: Re: Add a hook on isearch Message-ID: <20100923104023.5e44028e@pwslap01u.europe.root.pri> In-Reply-To: References: Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.6 (GTK+ 2.18.9; i686-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 23 Sep 2010 09:40:23.0263 (UTC) FILETIME=[582DFEF0:01CB5B03] X-Scanned-By: MailControl A-10-90-03 (www.mailcontrol.com) on 10.71.0.138 On Sat, 18 Sep 2010 18:50:42 +0200 Mikael Magnusson wrote: > commit 8ab10e2394da712db896662316fb4df304c212ef > Author: Mikael Magnusson > Date: Sat Sep 18 18:46:38 2010 +0200 > > Add zle-isearch-update I tried this and it seemed to work... There may be things you shouldn't be doing at that point but I'm not sure what they are. The exit hook needed to be after setting statusline to NULL. Apart from that, I'm not sure what the best place is. Index: Doc/Zsh/zle.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/zle.yo,v retrieving revision 1.88 diff -p -u -r1.88 zle.yo --- Doc/Zsh/zle.yo 8 Sep 2010 12:32:32 -0000 1.88 +++ Doc/Zsh/zle.yo 23 Sep 2010 09:32:30 -0000 @@ -887,6 +887,28 @@ If they do not exist, no special action provided is identical to that for any other editing widget. startitem() +tindex(zle-isearch-exit) +item(tt(zle-isearch-exit))( +Executed at the end of incremental search at the point where the isearch +prompt is removed from the display. See tt(zle-isearch-update) for +an example. +) +tindex(zle-isearch-update) +item(tt(zle-isearch-update))( +Executed within incremental search when the display is about to be +redrawn. Additional output below the incremental search prompt can be +generated by using `tt(zle -M)' within the widget. For example, + +example(zle-isearch-update+LPAR()RPAR() { zle -M "Line $HISTNO"; } +zle -N zle-isearch-update) + +Note the line output by `tt(zle -M)' is not deleted on exit from +incremental search. This can be done from a tt(zle-isearch-exit) +widget: + +example(zle-isearch-exit+LPAR()RPAR() { zle -M ""; } +zle -N zle-isearch-exit) +) tindex(zle-line-init) item(tt(zle-line-init))( Executed every time the line editor is started to read a new line Index: Src/Zle/zle_hist.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_hist.c,v retrieving revision 1.65 diff -p -u -r1.65 zle_hist.c --- Src/Zle/zle_hist.c 27 Apr 2010 08:58:35 -0000 1.65 +++ Src/Zle/zle_hist.c 23 Sep 2010 09:32:31 -0000 @@ -1472,6 +1472,7 @@ doisearch(char **args, int dir, int patt } else isearch_active = 0; ref: + zlecallhook("zle-isearch-update", NULL); zrefresh(); if (!(cmd = getkeycmd()) || cmd == Th(z_sendbreak)) { int i; @@ -1670,6 +1671,7 @@ doisearch(char **args, int dir, int patt } statusline = NULL; unmetafy_line(); + zlecallhook("zle-isearch-exit", NULL); if (exitfn) exitfn(zlenoargs); selectkeymap(okeymap, 1); -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom