summary refs log tree commit diff stats
path: root/hooks/post-up
diff options
context:
space:
mode:
Diffstat (limited to 'hooks/post-up')
-rwxr-xr-xhooks/post-up/emacs6
-rwxr-xr-xhooks/post-up/zsh34
2 files changed, 40 insertions, 0 deletions
diff --git a/hooks/post-up/emacs b/hooks/post-up/emacs
new file mode 100755
index 0000000..f6071b7
--- /dev/null
+++ b/hooks/post-up/emacs
@@ -0,0 +1,6 @@
+#!/usr/bin/env zsh
+
+if [[ -s $commands[emacs] ]]
+then
+	emacs --batch --eval '(batch-byte-recompile-directory 0)' ~/.emacs.d/
+fi
diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh
new file mode 100755
index 0000000..f964e2b
--- /dev/null
+++ b/hooks/post-up/zsh
@@ -0,0 +1,34 @@
+#!/usr/bin/env zsh
+ZDOTDIR="${XDG_CONFIG_HOME:~/.config}/zsh"
+
+if [[ ! -d ~/.zsh/cache ]]
+then
+	mkdir -p ~/.zsh/cache
+fi
+
+fasd_cache=~/.zsh/cache/fasd-init-zsh
+if [[ ! -s "$fasd_cache" || $ZDOTDIR/functions/fasd/fasd -nt "$fasd_cache" ]]; then
+	$ZDOTDIR/functions/fasd/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=(
+	$ZDOTDIR/functions/fasd/fasd
+	$fasd_cache
+	$ZDOTDIR/zshrc
+)
+
+if [[ -f $ZDOTDIR/${HOST%%.*}.zsh ]]; then
+	zfiles+=$ZDOTDIR/${HOST%%.*}.zsh
+fi
+if [[ $OSTYPE == freebsd* ]]; then
+	zfiles+=$ZDOTDIR/freebsd.zsh
+fi
+
+zrecompile -p -R $ZDOTDIR/.zshrc.zwc $zfiles -- \
+	-M .zsh/cache/compdump
+
+for fp in $ZDOTDIR/functions/*(/); do
+	zrecompile -p $fp $fp/*
+done