Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Qmail-Scanner-Diagnostics: from mail-qk0-f182.google.com by f.primenet.com.au (envelope-from <mikachu@gmail.com>, uid 7791) with qmail-scanner-2.11 
 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1.  
 Clear:RC:0(209.85.220.182):SA:0(1.1/5.0):. 
 Processed in 0.160952 secs); 28 Jul 2016 14:03:51 -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.1 required=5.0 tests=DATE_IN_PAST_06_12,
	FREEMAIL_FROM,SPF_PASS,T_DKIM_INVALID autolearn=no autolearn_force=no
	version=3.4.1
X-Envelope-From: mikachu@gmail.com
X-Qmail-Scanner-Mime-Attachments: |
X-Qmail-Scanner-Zip-Files: |
Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.220.182 as permitted sender)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :cc;
        bh=u3TTyqVRUVOKCGmcv4wFI0ZIbap4CyN5+HnzOSduCOY=;
        b=w/DUGw/sQIrz+mAVum2eO+6Lxb+T9vO7vjjk1kE3qZ68Dd5nXmNPX7MMhrOPaoiyL9
         LOxUh1e+qDFILIYGU391r1OpJopAx8RRy9XMZOoevAI2eE4w/hYjit5VuEbBmg3a2fln
         dgKRuXm8X79reot5BP8l6Y64Ii9p7feaKBeIiYWJRCVzivMn/w5npfDVg3VXzPiOoUgu
         u+q8fRhayDcsgIjuvk7QI8vWDH5E5AdLOLKRYAJufMMI1gKN1InMo6boCMic2LKBniKf
         cu7PMVNXILNlaJ37WMXEM51LEAVUliZtaLAzwg48bQf/JmKfdy7A43Y3St39vWPWItSH
         /Ypg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to:cc;
        bh=u3TTyqVRUVOKCGmcv4wFI0ZIbap4CyN5+HnzOSduCOY=;
        b=CEV//KrjEzzfN9vpEwq2APOaDMcXLE5LGePv8+mIAxInYWdyPYSv2quObzY9XecyTt
         WSWDlpFkdscgvXEoXFW5+UHpis0vxeDD+dXVmhirKcDDoyqP7EW2WEn1eJsH1QgKyoQM
         uNc5kjjsCmXpVez79kCM+HUXzK09RfbEq9BYI0oO+9S4xMQclNpI/2m82vzWxosMF8tH
         UjIGD+sGloMWsHKYMt6B8T1/x7coZyFgtp/IWDVfwkgrztYrNVO8XzNITwFt545yK87+
         +HQrCfBV0AoQwAQfPX0ix8naugATQzRvXAWtViyaUzORy8idYY5uQZuPB3BUfFDnIwgg
         9ycg==
X-Gm-Message-State: AEkoouuOtr+hOHMEu3wN74hT2LS1e9EkbgrZCgKjuJjbfM7DXXOuqnwrFQDepAyLhKxqr879homEqcuoJ2W0ZA==
X-Received: by 10.55.189.65 with SMTP id n62mr38823781qkf.3.1469673287501;
 Wed, 27 Jul 2016 19:34:47 -0700 (PDT)
MIME-Version: 1.0
In-Reply-To: <20160724213046.GA27932@tarsus.local2>
References: <20160723212335.GA20872@tarsus.local2> <160723181445.ZM20105@torch.brasslantern.com>
 <20160724213046.GA27932@tarsus.local2>
From: Mikael Magnusson <mikachu@gmail.com>
Date: Thu, 28 Jul 2016 04:34:47 +0200
Message-ID: <CAHYJk3Q23Mzj7QX3_6GPsR90xQpZuofx=RtjJk-RvBcoWSZPZQ@mail.gmail.com>
Subject: Re: [PATCH] add-zle-hook-widget zle-line-pre-redraw issue
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: zsh workers <zsh-workers@zsh.org>
Content-Type: text/plain; charset=UTF-8
X-Seq: zsh-workers 38958

On Sun, Jul 24, 2016 at 11:30 PM, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> Bart Schaefer wrote on Sat, Jul 23, 2016 at 18:14:45 -0700:
>> On Jul 23,  9:23pm, Daniel Shahaf wrote:
>> }
>> } 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.
>>
>> If zsh-syntax-highlighting doesn't depend on that behavior, it's probably
>> unlikely that anything else does.
>
> z-sy-h assumes that zle-line-finish sets $WIDGET, but doesn't assume
> anything else about $WIDGET.
>
>> } Each of the following alternative patches solves the issue:
>>
>> The "second option" obviously isn't finished / leaves a lot of dead
>> code behind.
>
> Indeed it isn't: the unidiff I'd sent was not the unidiff I would commit
> if that option is chosen.  Its purpose was not to be committed as is,
> only to unambiguously explain what the second alternative was.
>
> Sorry if that wasn't clear.
>
>> However, I think the first option is the correct one,
>> unless there's a good reason to leave $WIDGET alone; the context
>> that's being saved/restored by redrawhook() is important, because
>> we're in the middle of an arbitrary other widget
>>
>> This is actually related to what I was saying about it not being
>> appropriate to stick a list of callbacks on any widget.
>>
>> We can easily special-case add-zle-hook-widget to find the name another
>> way for this particular hook.  $funcstack[1] for example.
>
> Okay, so let's wait for Mikael to weigh in, then we can choose between
> making pre-redraw set $WIDGET or making a-z-h-w handle pre-redraw's not
> doing so.

I don't think I made a conscious decision about this when writing the
code, so if there's any dissimilarity between this and other things
it's probably unintentional. I don't use $WIDGET myself in my callback
either. I think I just copied the part that sets args[0] a bit blindly
from another callback, but in that one I bet it uses initthingy->nam
for the rthingy_nocreate() call too. So to summarize, feel free to
change it.

-- 
Mikael Magnusson

