From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 481 invoked by alias); 23 Jul 2016 21:23:51 -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: 38927 Received: (qmail 15149 invoked from network); 23 Jul 2016 21:23:50 -0000 X-Qmail-Scanner-Diagnostics: from hermes.apache.org 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(140.211.11.3):SA:0(-1.3/5.0):. Processed in 0.1806 secs); 23 Jul 2016 21:23:50 -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=-1.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, RP_MATCHES_RCVD autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: danielsh@apache.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at apache.org does not designate permitted sender hosts) Date: Sat, 23 Jul 2016 21:23:35 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: [PATCH] add-zle-hook-widget zle-line-pre-redraw issue Message-ID: <20160723212335.GA20872@tarsus.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.5.23 (2014-03-12) Hooks registered with «add-zle-hook-widget zle-line-pre-redraw $hook» aren't invoked. In contrast, hooks registered with zle-line-finish are invoked. The reason appears to be that, while in azhw:zle-line-init $WIDGET is "zle-line-init", in azhw:zle-line-pre-redraw $WIDGET is the name of the widget the user invoked (e.g., "self-insert"), so the 'zstyle -a' does not find the registered hooks. Each of the following alternative patches solves the issue: First option: [[[ diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index ac31d4e..9f2742a 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -1054,7 +1055,7 @@ void redrawhook(void) args[0] = initthingy->nam; args[1] = NULL; incompfunc = 0; - execzlefunc(initthingy, args, 0); + execzlefunc(initthingy, args, 1); incompfunc = old_incompfunc; unrefthingy(initthingy); unrefthingy(lbindk); ]]] Second option: [[[ diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index ac31d4e..90e54d6 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -1044,6 +1044,10 @@ getrestchar(int inchar, char *outstr, int *outcount) void redrawhook(void) { Thingy initthingy; + + zlecallhook("zle-line-pre-redraw", NULL); + return; + if ((initthingy = rthingy_nocreate("zle-line-pre-redraw"))) { int lastcmd_prev = lastcmd; int old_incompfunc = incompfunc; ]]] The principal differences seem to be which set of globals is saved/restored or changed/restored; however, which set it should be is all Greek to me. Cheers, Daniel (I haven't tested the other hook types.)