Moving to virtualenv directory when activated
Closed this issue · 3 comments
When you create a virtualenv through the following:
mkvirtualenv somevir -a ~/some/dir/
You should be taken to ~/some/dir/ when calling workon somevir
I realized that the path that a virtualenv should go to is saved in a file called .project
within the virtualenv dir
Currently solving it by doing the following:
(add-hook 'venv-postactivate-hook
'(lambda ()
(when (file-exists-p (expand-file-name ".project" venv-current-dir))
(cd (string-trim (with-temp-buffer
(insert-file-contents (expand-file-name ".project" venv-current-dir))
(buffer-string)
)))
)))
Huh, I was totally unaware of this virtualenvwrapper feature! I agree we should move to the project directory if one exists. Better yet would be having a way to do the equivalent of the -a
option from within emacs! For the first part, your implementation above looks good and I would happily merge a pull request to add it.
ref #35, which this is dup of, but this time around we have code to fix the problem and I have a better understanding of what the feature actually is 😁
I forked and made a commit but once testing it, it fails. Evaluating venv-postactivate-hook
results in nil
. Not sure what's up. Let me know if I missed something