On Thu, May 19, 2016 at 8:18 AM, Ken Mankoff <mankoff@gmail.com> wrote:
Thanks for the example. This makes conda + Org work better than it has for me in the past. Unfortunately, one major issues is editing and running code outside of Org via (org-edit-special). Perhaps elpy will support conda environments soon.
I think Elpy works fine with conda environments - you just have to call pyvenv-activate with the desired path.
You have inspired me to try and automate this for org source blocks (see org snippets below). It is a bit clunky, but I got it to work. Let me know what you think, and any stylistic corrections are welcome (my lisp skills are sadly lacking).
+ Then we need to make sure it is run whenever we edit a babel source block by doing something like =(wjh/elpy-pyvenv-activate-from-babel-info org-src--babel-info)=, and also to do =(pyvenv-deactivate)= when we leave
+ Unfortunately, there are no actual hooks that I can find for =org-edit-src-code= or =org-edit-src-exit=
+ For the activation part we can co-opt the =org-babel-edit-prep:python= function:
#+BEGIN_SRC emacs-lisp
(defun org-babel-edit-prep:python (info)
(wjh/elpy-pyvenv-activate-from-babel-info info))
#+END_SRC
+ Although this will break if =ob-python.el= decides to define =org-babel-edit-prep:python= one day
+ For the deactivation part, I can't see any other way than to use advice