zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <psprint@zdharma.org>
To: zsh-workers@zsh.org
Subject: Strange or interesting zcompile behavior, for in-loop func defs
Date: Mon, 17 Jul 2017 15:50:58 +0200	[thread overview]
Message-ID: <etPan.596cc0c2.33e30cbe.6b4@zdharma.org> (raw)

Hello,
I've added debugging message in execfuncdef():

        if (state->prog->dump || !names) {
            if (!names) {
                ...
            } else {
                fprintf( stderr, "Have dump for: %s, file: %s\n", s, state->prog->dump->filename);
                fflush( stderr );
                prog->flags = EF_MAP;
                incrdumpcount(state->prog->dump);

It outputs:

Have dump for: _zsh_highlight_widget_zle-isearch-update, file: /Users/sgniazdowski/.zplugin/lexicon.zwc

The point is: this function is declared in a loop:

         if [[ $cur_widget == zle-* ]] && [[ -z $widgets[$cur_widget] ]]; then
           _zsh_highlight_widget_${cur_widget}() { :; _zsh_highlight }

I do zcompile lexicon.zwc ~/.zplugin/lexicon/*, the directory contains function with the loop. Zcompile apparently picks up above function definition. But from where it gets ${cur_widget}? This is a dynamic data, established at runtime.

The loop:

https://github.com/zdharma/fast-syntax-highlighting/blob/07a76cd38123cac2e76aca35c0258d62b18ab490/fast-syntax-highlighting.plugin.zsh#L203-L240

--  
Sebastian Gniazdowski
psprint /at/ zdharma.org


             reply	other threads:[~2017-07-17 14:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-17 13:50 Sebastian Gniazdowski [this message]
2017-07-18  6:10 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=etPan.596cc0c2.33e30cbe.6b4@zdharma.org \
    --to=psprint@zdharma.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).