From bd8ae834ace31522332eb53cf1c16a90b125b6e3 Mon Sep 17 00:00:00 2001 From: Eric Nielsen Date: Tue, 10 Dec 2019 19:28:00 -0500 Subject: [PATCH] Give credit to zrecompile doc in zshcontrib(1) and make code closer to the one in the manual pages (unless for our code style). Why reinvent the wheel? This last change makes the arguments to zrecompile shorter (passing relative paths instead of full paths to each function file). The number of arguments can be huge. There are 1143 of them currently for /usr/local/Cellar/zsh/5.7.1/share/zsh/functions! --- src/stage1/50_zimfw_compile.zsh.erb | 5 +++-- zimfw.zsh | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/stage1/50_zimfw_compile.zsh.erb b/src/stage1/50_zimfw_compile.zsh.erb index 5da66fa..b9ba0f6 100644 --- a/src/stage1/50_zimfw_compile.zsh.erb +++ b/src/stage1/50_zimfw_compile.zsh.erb @@ -12,12 +12,13 @@ _zimfw_compile() { # Compile .zshrc zrecompile -p ${1} <%= home %>/.zshrc || return 1 - # Compile autoloaded functions + # Compile autoloaded functions, taken from zrecompile doc in zshcontrib(1) for zdir in ${fpath}; do [[ ${zdir} == (.|..) || ${zdir} == (.|..)/* ]] && continue zfile=(${zdir}/^(*.*)(N-.)) if [[ -w ${zdir:h} && -n ${zfile} ]]; then - zrecompile -p ${1} ${zdir}.zwc ${zfile} || return 1 + zfile=(${${(M)zfile%/*/*}#/}) + (cd ${zdir:h} && zrecompile -p ${1} ${zdir:t}.zwc ${zfile}) || return 1 fi done diff --git a/zimfw.zsh b/zimfw.zsh index 40b0a96..80679b7 100644 --- a/zimfw.zsh +++ b/zimfw.zsh @@ -46,12 +46,13 @@ _zimfw_compile() { # Compile .zshrc zrecompile -p ${1} ${ZDOTDIR:-${HOME}}/.zshrc || return 1 - # Compile autoloaded functions + # Compile autoloaded functions, taken from zrecompile doc in zshcontrib(1) for zdir in ${fpath}; do [[ ${zdir} == (.|..) || ${zdir} == (.|..)/* ]] && continue zfile=(${zdir}/^(*.*)(N-.)) if [[ -w ${zdir:h} && -n ${zfile} ]]; then - zrecompile -p ${1} ${zdir}.zwc ${zfile} || return 1 + zfile=(${${(M)zfile%/*/*}#/}) + (cd ${zdir:h} && zrecompile -p ${1} ${zdir:t}.zwc ${zfile}) || return 1 fi done @@ -264,7 +265,7 @@ _zimfw_clean_dumpfile() { } _zimfw_info() { - print 'Zim version: 1.0.0-SNAPSHOT (previous commit is 69d609d)' + print 'Zim version: 1.0.0-SNAPSHOT (previous commit is 660b8cd)' print -R 'ZIM_HOME: '${ZIM_HOME} print -R 'Zsh version: '${ZSH_VERSION} print -R 'System info: '$(command uname -a)