Commits

Daniel Hahler committed 7c94c07 Merge

Merge branch 'fix-zsh-lazy-completion'

Getting all fixes into my master, although it has a pull request: feel
free to nag me about cleaning it up, but the relevant commits should be
easy to cherry-pick from here.

I will keep fix-zsh-lazy-completion in a separate branch.

  • Participants
  • Parent commits a8f330a, 6a21bcd

Comments (0)

Files changed (1)

File virtualenvwrapper_lazy.sh

 
 # Load the real implementation of the API from virtualenvwrapper.sh
 function virtualenvwrapper_load {
-    source "$VIRTUALENVWRAPPER_SCRIPT"
+    # Only source the script once.
+    # We might get called multiple times, because not all of _VIRTUALENVWRAPPER_API gets
+    # a real completion.
+    if [ -z $VIRTUALENVWRAPPER_LAZY_LOADED ]; then
+        if [ -n "$ZSH_VERSION" ] ; then
+            # Tried to unset any auto-load completion, does not appear to work/triggers a crash
+            # compctl + $(echo ${_VIRTUALENVWRAPPER_API})
+        fi
+        source "$VIRTUALENVWRAPPER_SCRIPT"
+        VIRTUALENVWRAPPER_LAZY_LOADED=1
+    fi
 }
 
 # Set up "alias" functions based on the API definition.
 }
 
 virtualenvwrapper_setup_lazy_loader
+# Does not really work. Cannot be reset in zsh to fallback to files (e.g. mkvirtualenv).
+# It also needs a second invocation, because the first one only sets up the real completion.
 virtualenvwrapper_setup_lazy_completion