Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make auto-workon work with text files containing virtualenv name #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dakra
Copy link
Contributor

@dakra dakra commented Jul 20, 2017

This way you can keep all your virtualenvs in one place and can reuse
the same virtualenv for multiple projects.

Virtualfish (virtualenvwrapper for fish shell) does this as well,
see: http://virtualfish.readthedocs.io/en/latest/plugins.html#auto-activation-auto-activation

@dakra
Copy link
Contributor Author

dakra commented Aug 8, 2017

@porterjamesj bump ;)

@porterjamesj
Copy link
Owner

Whoops, sorry. Been busy; aren't we all -__-

I will try to look at this tonight!

Copy link
Owner

@porterjamesj porterjamesj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good! The only other thing is that I'd love to see a test for this before merging.

(when path
(setq venv-current-name path) ;; there's really nothing that feels good to do here ;_;
(venv--activate-dir path))))
(if (and path (file-regular-p path) (file-readable-p path))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment here clarifying what this code does? Doesn't have to be long, I just find if a bit hard to read in ELisp since there's no explicit else and I don't want to be scratching my head on this code more than necessary somewhere down the road.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment.
Please check if the comment makes it clear what the code does.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect!

whose name is in the list `venv-dirlookup-names` it will be
automatically activated. By default, it's value is `'(".venv", "venv")'`,
but you can set if however you like to match your naming conventions:
As long as a virtualenv or a text file with the name of the virtualenv is
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, could you check "allow edits from maintainers". There's a couple clarifications I'd like to make to this documentation that are probably easier for me to just do than to explain :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Allow edits from maintainers" is checked. Edit away :)

@dakra
Copy link
Contributor Author

dakra commented Aug 9, 2017

I'll add a test later this week. Thanks.

@porterjamesj
Copy link
Owner

@dakra bump! Are you planning to come back and add a test to this anytime soon? If not I'd like to close just for the sake of tidiness. Github stills seems not happy with me pushing to your fork even thought the "allow commits from maintainers" box is checked, so I can just add the doc fix after we merge if so.

@dakra
Copy link
Contributor Author

dakra commented Nov 1, 2017

@porterjamesj Sorry for the late reply. I'm still using it daily.

I added a test function but unfortunately it's not working.
I spend too much time trying to figure out why.
It seems to be in that calling (venv-is-valid name) inside
(venv-workon) is not working.
Or at least (message "X") does work before calling it and
not after, but a message INSIDE (venv-is-valid name) still works.

Maybe you can have look and find out why?

Thanks.

This way you can keep all your virtualenvs in one place and can reuse
the same virtualenv for multiple projects.

Virtualfish (virtualenvwrapper for fish shell) does this as well,
see: http://virtualfish.readthedocs.io/en/latest/plugins.html#auto-activation-auto-activation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants