diff options
author | Alan Pearce | 2013-05-18 21:00:12 +0100 |
---|---|---|
committer | Alan Pearce | 2013-05-18 21:00:12 +0100 |
commit | 5649afdf7e4ab16bbbe8f9fb9c487125efa76b5f (patch) | |
tree | ff5c03fb808b37734c59615d94b88553f03e4d40 | |
parent | 9c6faab4adf09bd93e3ae84174df220538fa9a0b (diff) | |
download | dotfiles-5649afdf7e4ab16bbbe8f9fb9c487125efa76b5f.tar.lz dotfiles-5649afdf7e4ab16bbbe8f9fb9c487125efa76b5f.tar.zst dotfiles-5649afdf7e4ab16bbbe8f9fb9c487125efa76b5f.zip |
Migrate zsh file compilation to post-checkout hook
-rwxr-xr-x | git-hooks/post-checkout | 26 | ||||
-rwxr-xr-x | zsh/zshrc | 23 |
2 files changed, 27 insertions, 22 deletions
diff --git a/git-hooks/post-checkout b/git-hooks/post-checkout index dfceaee..910716f 100755 --- a/git-hooks/post-checkout +++ b/git-hooks/post-checkout @@ -4,3 +4,29 @@ then emacs --batch -f batch-byte-compile ~/.emacs.d/init.el emacs --batch -f batch-byte-compile ~/.emacs.d/elisp/*.el fi + +fasd_cache=~/.zsh/cache/fasd-init-zsh +if [[ ! -s "$fasd_cache" || zsh/functions/fasd -nt "$fasd_cache" ]]; then + zsh/functions/fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" +fi + +autoload -U zrecompile +local -a zfiles +zfiles=( + zsh/functions/fasd/fasd + $fasd_cache + zsh/zshrc + zsh/zshrc_${HOST%%.*} +) +if [[ -e /usr/bin/emerge ]]; then + zfiles+=zsh/zshrc_gentoo +fi +if [[ $OSTYPE == freebsd ]]; then + zfiles+=zsh/zshrc_freebsd +fi + +zrecompile -p -R ~/.zshrc.zwc $zfiles + +for fp in zsh/functions/*(/); do + zrecompile -p $fp $fp/* +done diff --git a/zsh/zshrc b/zsh/zshrc index e47adaf..9437fcc 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -340,30 +340,9 @@ smart_compile () { fi } -host=${HOST%%.*} -if [[ -e ~alan/dotfiles/zsh/zshrc_$host ]]; then - # Don't recompile as toor|root - smart_compile ~alan/dotfiles/zsh/zshrc_$host 1 -fi -if [[ -e /usr/bin/emerge ]]; then - smart_compile ~alan/dotfiles/zsh/zshrc_gentoo 1 -elif [[ $freebsd -eq 1 ]]; then - smart_compile ~alan/dotfiles/zsh/zshrc_freebsd 1 -fi - -for fp in $myfuncs; do - zrecompile -p $fp $fp/* -done - _FASD_DATA="$HOME/.zsh/fasd-data" -fasd_cache="$HOME/.zsh/cache/fasd-init-zsh" autoload -U fasd -if [[ ! -s "$fasd_cache" || ~alan/dotfiles/zsh/functions/fasd -nt "$fasd_cache" ]]; then - fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" -fi -smart_compile "$fasd_cache" 1 -unset fasd_cache +source ~/.zsh/cache/fasd-init-zsh alias e="f -e $EDITOR" -smart_compile ~/.zshrc alias s="smart_sudo " |