X-Git-Url: https://git.madduck.net/etc/zsh.git/blobdiff_plain/dbdc7eafae07bf7a5830402200e1d5fe9188a622..a5062beb39198fd202dec7b8ca7b2a3ed2d81c27:/.zsh/zshrc/99_hook_functions?ds=inline diff --git a/.zsh/zshrc/99_hook_functions b/.zsh/zshrc/99_hook_functions index a934d04..34abb0e 100644 --- a/.zsh/zshrc/99_hook_functions +++ b/.zsh/zshrc/99_hook_functions @@ -10,10 +10,13 @@ autoload -U is-at-least if ! is-at-least 4.3.6; then - precmd() { for fn ($precmd_functions) $fn "$@" } - preexec() { for fn ($preexec_functions) $fn "$@" } - chpwd() { for fn ($chpwd_functions) $fn "$@" } - periodic() { for fn ($periodic_functions) $fn "$@" } + for i in precmd preexec chpwd periodic; do + if [ -n "$functions[$i]" ]; then + warn "$i function already defined" + continue + fi + eval "${i}() { for fn (\$${i}_functions) \$fn \"\$@\" }" + done fi # vim:ft=zsh