From 020a9152b74077475f5974362f1eb42813083657 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 11 Dec 2014 16:22:54 +0100 Subject: [PATCH] Fix being loaded from a function (antigen) Fixes https://github.com/Tarrasch/zsh-autoenv/issues/14 --- autoenv.zsh | 5 +++-- tests/ZDOTDIR.loadviafunction/.zshenv | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 tests/ZDOTDIR.loadviafunction/.zshenv diff --git a/autoenv.zsh b/autoenv.zsh index bfd9347..14c4a7a 100644 --- a/autoenv.zsh +++ b/autoenv.zsh @@ -42,9 +42,10 @@ autoenv_source_parent() { # Internal functions. {{{ # Internal: stack of entered (and handled) directories. {{{ -typeset -a _autoenv_stack_entered +typeset -g -a _autoenv_stack_entered _autoenv_stack_entered=() -typeset -A _autoenv_stack_entered_mtime +# -g: make it global, this is required when used with antigen. +typeset -g -A _autoenv_stack_entered_mtime _autoenv_stack_entered_mtime=() # Add an entry to the stack, and remember its mtime. diff --git a/tests/ZDOTDIR.loadviafunction/.zshenv b/tests/ZDOTDIR.loadviafunction/.zshenv new file mode 100644 index 0000000..4e41fbc --- /dev/null +++ b/tests/ZDOTDIR.loadviafunction/.zshenv @@ -0,0 +1,12 @@ +test -f "$TESTDIR/.zcompdump" && rm "$TESTDIR/.zcompdump" + +AUTOENV_DEBUG=0 + +antigen-like-loader-function() { + source "$TESTDIR/../autoenv.plugin.zsh" +} +antigen-like-loader-function + +export AUTOENV_ENV_FILENAME="$PWD/.env_auth" + +echo -n > $AUTOENV_ENV_FILENAME