]> Sergey Matveev's repositories - zsh-autoenv.git/commitdiff
Fix being loaded from a function (antigen)
authorDaniel Hahler <git@thequod.de>
Thu, 11 Dec 2014 15:22:54 +0000 (16:22 +0100)
committerDaniel Hahler <git@thequod.de>
Thu, 11 Dec 2014 15:22:54 +0000 (16:22 +0100)
Fixes https://github.com/Tarrasch/zsh-autoenv/issues/14

autoenv.zsh
tests/ZDOTDIR.loadviafunction/.zshenv [new file with mode: 0644]

index bfd93474506e82e2c1733cd11fb4a742d748cac6..14c4a7a2e114277d0e23eb88e56165047e7c0c9b 100644 (file)
@@ -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 (file)
index 0000000..4e41fbc
--- /dev/null
@@ -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