From 0425bfbe74fdd313f18dcff51a42fe39e338f83d Mon Sep 17 00:00:00 2001 From: Russell Cloran Date: Fri, 6 Oct 2023 15:07:43 -0700 Subject: [PATCH] Fix non-interactive compilation `.znap.compile` checks the `funcstack`, with the intent of determining whether or not to output user visible messages -- they should only be output when called directly from the `znap` CLI tool. Unfortunately, this check was written in a way that means that when called from outside of the main znap function (eg, compdump background compilation, auto-compile), no compilation happened. This change re-orders the checks so that `.znap.compile` works when called from other parts of znap. Fixes #267 --- functions/.znap.compile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/functions/.znap.compile b/functions/.znap.compile index b3eeb7d..7774b2c 100644 --- a/functions/.znap.compile +++ b/functions/.znap.compile @@ -49,8 +49,10 @@ while (( $#files[@] )); do opt=R fi - if [[ $funcstack[2] == znap ]] && emulate zsh -c "zcompile -U$opt -- ${(q)f}"; then - print -Pr -- "${(D)f:h}/%F{green}$f:t.zwc%f" + if emulate zsh -c "zcompile -U$opt -- ${(q)f}"; then + if [[ $funcstack[2] == znap ]] ; then + print -Pr -- "${(D)f:h}/%F{green}$f:t.zwc%f" + fi else ret=1 zf_rm -f -- $f.zwc