From 2995b7d0c89d628a68ea789e21ea8f26ea8fa4d9 Mon Sep 17 00:00:00 2001 From: Casey McGinty Date: Sun, 6 May 2018 13:19:35 -0700 Subject: [PATCH] Update cache files when .zpreztorc file is modified Fixes #1581 --- modules/fasd/init.zsh | 4 +++- modules/node/init.zsh | 4 +++- modules/perl/init.zsh | 2 +- modules/python/init.zsh | 4 +++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/fasd/init.zsh b/modules/fasd/init.zsh index 113a871..37babd8 100644 --- a/modules/fasd/init.zsh +++ b/modules/fasd/init.zsh @@ -20,7 +20,9 @@ fi # cache_file="${TMPDIR:-/tmp}/prezto-fasd-cache.$UID.zsh" -if [[ "${commands[fasd]}" -nt "$cache_file" || ! -s "$cache_file" ]]; then +if [[ "${commands[fasd]}" -nt "$cache_file" \ + || "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \ + || ! -s "$cache_file" ]]; then # Set the base init arguments. init_args=(zsh-hook) diff --git a/modules/node/init.zsh b/modules/node/init.zsh index 578c642..0a516f0 100644 --- a/modules/node/init.zsh +++ b/modules/node/init.zsh @@ -32,7 +32,9 @@ fi if (( $+commands[npm] )); then cache_file="${TMPDIR:-/tmp}/prezto-node-cache.$UID.zsh" - if [[ "$commands[npm]" -nt "$cache_file" || ! -s "$cache_file" ]]; then + if [[ "$commands[npm]" -nt "$cache_file" \ + || "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \ + || ! -s "$cache_file" ]]; then # npm is slow; cache its output. npm completion >! "$cache_file" 2> /dev/null fi diff --git a/modules/perl/init.zsh b/modules/perl/init.zsh index 3bed638..b7a7947 100644 --- a/modules/perl/init.zsh +++ b/modules/perl/init.zsh @@ -43,7 +43,7 @@ if [[ "$OSTYPE" == darwin* ]]; then perl_path="$HOME/Library/Perl/5.12" if [[ -f "$perl_path/lib/perl5/local/lib.pm" ]]; then - if [[ ! -s "$cache_file" ]]; then + if [[ "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" || ! -s "$cache_file" ]]; then perl -I$perl_path/lib/perl5 -Mlocal::lib=$perl_path >! "$cache_file" fi diff --git a/modules/python/init.zsh b/modules/python/init.zsh index 4bd38ad..45e9b8d 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -149,7 +149,9 @@ if (( $#commands[(i)pip(|[23])] )); then # Detect and use one available from among 'pip', 'pip2', 'pip3' variants pip_command="$commands[(i)pip(|[23])]" - if [[ "$pip_command" -nt "$cache_file" || ! -s "$cache_file" ]]; then + if [[ "$pip_command" -nt "$cache_file" \ + || "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \ + || ! -s "$cache_file" ]]; then # pip is slow; cache its output. And also support 'pip2', 'pip3' variants $pip_command completion --zsh \ | sed -e "s|compctl -K [-_[:alnum:]]* pip|& pip2 pip3|" >! "$cache_file" 2> /dev/null