[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [babel] Setting python interpreter version on per-block or per-s
From: |
Sacha Chua |
Subject: |
Re: [O] [babel] Setting python interpreter version on per-block or per-subtree basis |
Date: |
Thu, 24 Apr 2014 21:59:18 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (windows-nt) |
William Henney <address@hidden> writes:
Hello, Will!
> Is there an easy way to specify the python version to use for a particular
> block or sub-tree?
Is it something you can define an inherited property or a tag for, and
then add some advice around org-babel-execute:python to check that
property and use let to bind org-babel-python-comand?
Maybe something like this, for example:
#+begin_src emacs-lisp
(defadvice org-babel-execute:python (around will activate)
(if (member "python2" (org-get-tags-at))
(let ((org-babel-python-command "/path/to/python2"))
ad-do-it)
ad-do-it))
#+end_src
* Test :python2:
#+begin_src python
return 1 + 3
#+end_src
Sacha