]> git.madduck.net Git - etc/zsh.git/commitdiff

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:

use a loop to define functions
authormartin f. krafft <madduck@madduck.net>
Tue, 6 May 2008 20:40:58 +0000 (21:40 +0100)
committermartin f. krafft <madduck@madduck.net>
Tue, 6 May 2008 20:40:58 +0000 (21:40 +0100)
.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