]> Sergey Matveev's repositories - zsh-autoenv.git/blobdiff - autoenv.zsh
Merge pull request #71 from blueyed/minor
[zsh-autoenv.git] / autoenv.zsh
index c6ecbfe2174aa06c1aeff6cdc90ae5bc3e717221..4ccc9ae8076de04dac7ea60b2d62d78dd352447b 100644 (file)
@@ -290,7 +290,7 @@ _autoenv_source() {
   # XXX: pollutes environment with e.g. `stash`, and `autostash` will cause
   # an overwritten `stash` function to be called!
   if ! (( $+functions[autostash] )); then
-    if \grep -qE '\b(autostash|autounstash|stash)\b' $autoenv_env_file; then
+    if \grep -qE '\b(autostash|autounstash|stash|unstash)\b' $autoenv_env_file; then
       source ${${funcsourcetrace[1]%:*}:h}/lib/varstash
     fi
     # NOTE: Varstash uses $PWD as default for varstash_dir, we might set it to
@@ -299,7 +299,7 @@ _autoenv_source() {
 
   # Source the env file.
   _autoenv_debug "== SOURCE: ${bold_color:-}$autoenv_env_file${reset_color:-}\n      PWD: $PWD"
-  : $(( _autoenv_debug_indent++ ))
+  (( ++_autoenv_debug_indent ))
 
   local restore_xtrace
   if [[ $AUTOENV_DEBUG -gt 2 && ! -o xtrace ]]; then
@@ -310,7 +310,7 @@ _autoenv_source() {
   if (( restore_xtrace )); then
     setopt noxtrace
   fi
-  : $(( _autoenv_debug_indent-- ))
+  (( --_autoenv_debug_indent ))
   _autoenv_debug "== END SOURCE =="
 
   if [[ $autoenv_event == enter ]]; then
@@ -403,7 +403,7 @@ _autoenv_chpwd_handler() {
       if ! [[ ${PWD}/ == ${prev_dir}/* ]]; then
         local env_file_leave=$prev_dir/$AUTOENV_FILE_LEAVE
         if _autoenv_check_authorized_env_file $env_file_leave; then
-          _autoenv_source $env_file_leave leave $prev_dir
+          varstash_dir=$prev_dir _autoenv_source $env_file_leave leave $prev_dir
         fi
 
         # Unstash any autostashed stuff.
@@ -440,7 +440,7 @@ _autoenv_chpwd_handler() {
   _autoenv_debug "Sourcing from chpwd handler: $env_file"
   _autoenv_source $env_file enter
 
-  : $(( _autoenv_debug_indent++ ))
+  (( ++_autoenv_debug_indent ))
 }
 # }}}