]> git.madduck.net Git - etc/zsh.git/blobdiff - .zsh/zshrc/99_hook_functions

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Prefix bzr branch
[etc/zsh.git] / .zsh / zshrc / 99_hook_functions
index a934d04f2231846704d83fcdf84522de284d7d5e..34abb0e72284cc86e1aac23dd7f9f7ee25c846cc 100644 (file)
 
 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