Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: add-zle-hook-widget Re: Next release (5.3)



Bart Schaefer wrote on Wed, Jul 13, 2016 at 17:11:52 -0700:
> -# Handle zsh autoloading conventions
> -if [[ "$zsh_eval_context" = *loadautofunc && ! -o kshautoload ]]; then
> -    add-zle-hook-widget "$@"
> -fi
> +# Handle zsh autoloading conventions:
> +# - "file" appears last in zsh_eval_context when "source"-ing
> +# - "evalautofunc" appears with kshautoload set or autoload -k
> +# - "loadautofunc" appears with kshautoload unset or autoload -z
> +# - use of autoload +X cannot reliably be detected, use best guess
> +case "$zsh_eval_context" in
> +*file) ;;
> +*evalautofunc) ;;
> +*loadautofunc) add-zle-hook-widget "$@";;
> +*) [[ -o kshautoload ]] || add-zle-hook-widget "$@";;

The [[ -o ]] test will be always false because of the 'emulate -L zsh'
at the top, won't it?

This hunk should also be applied to bracketed-paste-magic; there there
is no toplevel 'emulate'.

> +esac
> +# Note fallback here is equivalent to the usual best-guess used by
> +# functions written for zsh before $zsh_eval_context was available
> +# so this case-statement is backward-compatible.


Bart Schaefer wrote on Sat, Jul 16, 2016 at 18:51:03 -0700:
> It also switches from defining the hooks functions in a loop to defining
> them with multifuncdef syntax, and updates contrib.yo.

The new docs look great, thank you very much! ☺



Messages sorted by: Reverse Date, Date, Thread, Author