Subject: Re: [PATCH] _add-zle-hook-widget: New completion.
From: Bart Schaefer <[email-masked]>
To: [email-masked]
Date: Sun, 17 Jul 2016 12:21:19 -0700
List-Id: Zsh Workers List <zsh-workers.zsh.org>

On Jul 17,  3:00pm, Daniel Shahaf wrote:
}
} I wanted to use 'autoload +X add-zle-hook-widget; zstyle -g reply
} zle-hook types' to avoid duplicating $hooktypes, but couldn't get it
} to work. (Neither with -k nor with -z was the style defined)

Er, yeah:

     The flag +X attempts to load each NAME as an autoloaded function,
     but does _not_ execute it.

This is in part why I went to some lengths to be able to "source" the
file as well as autoload it.

You could do this:

_add-zle-hook-widget_classes() {
  local -a hooktypes=( ${^${=${(f)"$( add-zle-hook-widget -h )"}[3]}} )
  compadd "$@" -M 'L:|zle-=' -a hooktypes
}