diff --git a/CHANGELOG.md b/CHANGELOG.md index c8d5c5e..4d9e2d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -_No unreleased changes._ +### Fixed + +- Use `_zim_dumpfile_fpath` defined by the completion module + [here](https://github.com/zimfw/completion/blob/33737e8c15fa8dba9af47bef8408b1af2599c21b/init.zsh#L11), + right before `compinit` is run, to more accurately do `zimfw check-dumpfile`. ## [1.11.0] - 2022-12-18 diff --git a/src/stage2/29_zimfw_build_init.zsh.erb b/src/stage2/29_zimfw_build_init.zsh.erb index 9822237..8a36e00 100644 --- a/src/stage2/29_zimfw_build_init.zsh.erb +++ b/src/stage2/29_zimfw_build_init.zsh.erb @@ -22,8 +22,7 @@ _zimfw_build_init() { fi done zpre=$'*\0' - print -R 'typeset -gr _zim_fpath=('${${_zfpaths#${~zpre}}:A}')' - if (( ${#_zfpaths} )) print 'fpath=(${_zim_fpath} ${fpath})' + if (( ${#_zfpaths} )) print 'fpath=('${${_zfpaths#${~zpre}}:A}' ${fpath})' if (( ${#zfunctions} )) print -R 'autoload -Uz -- '${zfunctions#${~zpre}} for zroot_dir in ${_zroot_dirs}; do zpre=${zroot_dir}$'\0' diff --git a/src/stage2/50_zimfw_check_dumpfile.zsh.erb b/src/stage2/50_zimfw_check_dumpfile.zsh.erb index f4d8c94..290f063 100644 --- a/src/stage2/50_zimfw_check_dumpfile.zsh.erb +++ b/src/stage2/50_zimfw_check_dumpfile.zsh.erb @@ -2,19 +2,17 @@ _zimfw_check_dumpfile() { local zdumpfile zfpath zline zstyle -s ':zim:completion' dumpfile 'zdumpfile' || zdumpfile=<%= home %>/.zcompdump if [[ -e ${zdumpfile} ]]; then - if (( ${+_zim_fpath} )); then - local -r zpre=$'*\0' - zfpath=(${${_zfpaths#${~zpre}}:A} ${fpath:|_zim_fpath}) + if (( ${+_zim_dumpfile_fpath} )); then + local -r zcomps=(${^_zim_dumpfile_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t)) + IFS=$' \t' read -rA zline < ${zdumpfile} || return 1 + if [[ ${zline[2]} -eq ${#zcomps} && ${zline[4]} == ${ZSH_VERSION} ]]; then + _zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b Already up to date" + else + _zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b New completion configuration needs to be dumped. Will do %Bclean-dumpfile%b." + _zimfw_clean_dumpfile + fi else - zfpath=(${fpath}) - fi - local -r zcomps=(${^zfpath}/^([^_]*|*~|*.zwc(|.old))(N:t)) - IFS=$' \t' read -rA zline < ${zdumpfile} || return 1 - if [[ ${zline[2]} -eq ${#zcomps} && ${zline[4]} == ${ZSH_VERSION} ]]; then - _zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b Already up to date" - else - _zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b New completion configuration needs to be dumped. Will do %Bclean-dumpfile%b." - _zimfw_clean_dumpfile + _zimfw_print -u2 -PR "%F{yellow}<%= warn %>%B${zdumpfile}:%b Unable to check. This only works when the completion module is initialized." fi else _zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b Not found" diff --git a/zimfw.zsh b/zimfw.zsh index a1f20f1..e8d73e0 100644 --- a/zimfw.zsh +++ b/zimfw.zsh @@ -74,8 +74,7 @@ _zimfw_build_init() { fi done zpre=$'*\0' - print -R 'typeset -gr _zim_fpath=('${${_zfpaths#${~zpre}}:A}')' - if (( ${#_zfpaths} )) print 'fpath=(${_zim_fpath} ${fpath})' + if (( ${#_zfpaths} )) print 'fpath=('${${_zfpaths#${~zpre}}:A}' ${fpath})' if (( ${#zfunctions} )) print -R 'autoload -Uz -- '${zfunctions#${~zpre}} for zroot_dir in ${_zroot_dirs}; do zpre=${zroot_dir}$'\0' @@ -406,19 +405,17 @@ _zimfw_check_dumpfile() { local zdumpfile zfpath zline zstyle -s ':zim:completion' dumpfile 'zdumpfile' || zdumpfile=${ZDOTDIR:-${HOME}}/.zcompdump if [[ -e ${zdumpfile} ]]; then - if (( ${+_zim_fpath} )); then - local -r zpre=$'*\0' - zfpath=(${${_zfpaths#${~zpre}}:A} ${fpath:|_zim_fpath}) + if (( ${+_zim_dumpfile_fpath} )); then + local -r zcomps=(${^_zim_dumpfile_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t)) + IFS=$' \t' read -rA zline < ${zdumpfile} || return 1 + if [[ ${zline[2]} -eq ${#zcomps} && ${zline[4]} == ${ZSH_VERSION} ]]; then + _zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b Already up to date" + else + _zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b New completion configuration needs to be dumped. Will do %Bclean-dumpfile%b." + _zimfw_clean_dumpfile + fi else - zfpath=(${fpath}) - fi - local -r zcomps=(${^zfpath}/^([^_]*|*~|*.zwc(|.old))(N:t)) - IFS=$' \t' read -rA zline < ${zdumpfile} || return 1 - if [[ ${zline[2]} -eq ${#zcomps} && ${zline[4]} == ${ZSH_VERSION} ]]; then - _zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b Already up to date" - else - _zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b New completion configuration needs to be dumped. Will do %Bclean-dumpfile%b." - _zimfw_clean_dumpfile + _zimfw_print -u2 -PR "%F{yellow}! %B${zdumpfile}:%b Unable to check. This only works when the completion module is initialized." fi else _zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b Not found" @@ -457,7 +454,7 @@ _zimfw_compile() { } _zimfw_info() { - print -R 'zimfw version: '${_zversion}' (built at 2022-12-18 21:05:25 UTC, previous commit is e54958b)' + print -R 'zimfw version: '${_zversion}' (built at 2023-02-03 23:52:16 UTC, previous commit is 281cde5)' print -R 'OSTYPE: '${OSTYPE} print -R 'TERM: '${TERM} print -R 'TERM_PROGRAM: '${TERM_PROGRAM}