jorgenschaefer/pyvenv — pull request #4 by lunaryorn (2014-02-24 13:27:48+00:00)
Title: Generalize pyvenv-mode

Inspect the file virtualenv from `pyvenv-workon` regardless of the current major mode, by hooking into `hack-local-variables-hook` instead of `python-mode`. This makes this package useful for other major modes which may want to use the current virtualenv as well, for instance ReST mode buffers for the Sphinx documentation of a Python project.

If the user stills wants to enable the virtualenv only in Python Mode buffers, they can just limit the dir local variables to python mode.

Also, with this change pyvenv-mode does not longer attempt to inspect `pyvenv-mode` *before* local variables were loaded, because `hack-local-variables-hook` is guaranteed to be called after local variables. For major mode hooks, there is no such guarantee, and in fact, at least on recent Emacs versions major mode hooks are called before local variables!