Re: [O] Wish: babel for python3

2011-10-18 Thread Torsten Wagner

Hi,
(sorry Arne for the eventual double post, I forogot to attt the mailing 
list)



Is there a way to get python3 support for Babel into org-mode
cleanly?




Something like:
-*- org-babel-python-command: python3



alternatively (a trick Eric is never tired to mention to me ) you could 
add a little lisp block which change all kind of language related 
aspects for you. This could include many more options and modify your 
emacs environment just to your personal needs for a certain language.


Make one for python2 and one for python3 and execute them dependent on 
which system you are going to use.


Without testing and without guarantee it should be something like the 
below code. To demonstrate some more functionality lets change the 
modebar background colour to make it more visible which python mode you 
are currently using.



#+srcname: python2_env
#+begin_src emacs-lisp
 (setq org-babel-python-command python)
 (set-face-background 'modeline #4477aa)
#+end_src

#+srcname: python3_env
#+begin_src emacs-lisp
 (setq org-babel-python-command python3)
 (set-face-background 'modeline #771944)
#+end_src

Sure both could be done with file bounded variables too. But know you 
can switch between both environments within the same buffer, e.g., to 
check if the code runs on both python versions


Regards

Totti



Re: [O] Wish: babel for python3

2011-10-18 Thread Rasmus
Torsten Wagner torsten.wag...@gmail.com writes:
 alternatively (a trick Eric is never tired to mention to me ) you
 could
 add a little lisp block which change all kind of language related
 aspects for you. This could include many more options and modify your
 emacs environment just to your personal needs for a certain language.

 Make one for python2 and one for python3 and execute them dependent on
 which system you are going to use.

 Without testing and without guarantee it should be something like the
 below code. To demonstrate some more functionality lets change the
 modebar background colour to make it more visible which python mode
 you
 are currently using.
 #+srcname: python2_env
 #+begin_src emacs-lisp
   (setq org-babel-python-command python)
   (set-face-background 'modeline #4477aa)
 #+end_src
 #+srcname: python3_env
 #+begin_src emacs-lisp
   (setq org-babel-python-command python3)
   (set-face-background 'modeline #771944)
 #+end_src


That is pure awesomeness!  

Thanks,
Rasmus

-- 
Sent from my Emacs




[O] Wish: babel for python3

2011-10-15 Thread Arne Babenhauserheide
Hi, 

I’d love to have babel for python3. 

My first shot at it would just be ob-python.el with each mention of python 
replaced by python3, but I hope that there is a more elegant way… 

Is there a way to get python3 support for Babel into org-mode cleanly?

Best wishes, 
Arne



Re: [O] Wish: babel for python3

2011-10-15 Thread Eric Schulte
Hi Arne,

I think you can simply add the following to your configuration to use
python3 as your python executable.

  (setq org-babel-python-command python3)

Best -- Eric

Arne Babenhauserheide arne_...@web.de writes:

 Hi, 

 I’d love to have babel for python3. 

 My first shot at it would just be ob-python.el with each mention of python 
 replaced by python3, but I hope that there is a more elegant way… 

 Is there a way to get python3 support for Babel into org-mode cleanly?

 Best wishes, 
 Arne


-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] Wish: babel for python3

2011-10-15 Thread Arne Babenhauserheide
Hi Eric,

Can I then still use babel for python 2.x? I need it for both, because I have
python3 and python2 projects.

Best wishes,
Arne

Am Samstag, 15. Oktober 2011, 12:36:52 schrieb Eric Schulte:
 Hi Arne,

 I think you can simply add the following to your configuration to use
 python3 as your python executable.

   (setq org-babel-python-command python3)

 Best -- Eric

 Arne Babenhauserheide arne_...@web.de writes:
  Hi,
 
  I’d love to have babel for python3.
 
  My first shot at it would just be ob-python.el with each mention of
  python replaced by python3, but I hope that there is a more elegant
  way…
 
  Is there a way to get python3 support for Babel into org-mode cleanly?
 
  Best wishes,
  Arne

--
Ein Würfel System - einfach saubere Regeln:

- http://1w6.org



signature.asc
Description: This is a digitally signed message part.


Re: [O] Wish: babel for python3

2011-10-15 Thread Thomas S. Dye
Arne Babenhauserheide arne_...@web.de writes:

 Hi Eric, 

 Can I then still use babel for python 2.x? I need it for both, because I have 
 python3 and python2 projects. 

 Best wishes, 
 Arne

Aloha Arne,

If your projects are in different files, then you should be able to use
file variables:
http://www.gnu.org/s/libtool/manual/emacs/Specifying-File-Variables.html#Specifying-File-Variables.

Something like:
-*- org-babel-python-command: python3

hth,
Tom


 Am Samstag, 15. Oktober 2011, 12:36:52 schrieb Eric Schulte:
 Hi Arne,
 
 I think you can simply add the following to your configuration to use
 python3 as your python executable.
 
   (setq org-babel-python-command python3)
 
 Best -- Eric
 
 Arne Babenhauserheide arne_...@web.de writes:
  Hi,
  
  I’d love to have babel for python3.
  
  My first shot at it would just be ob-python.el with each mention of
  python replaced by python3, but I hope that there is a more elegant
  way…
  
  Is there a way to get python3 support for Babel into org-mode cleanly?
  
  Best wishes,
  Arne

 --
 Ein Würfel System - einfach saubere Regeln: 

 - http://1w6.org


-- 
Thomas S. Dye
http://www.tsdye.com



Re: [O] Wish: babel for python3

2011-10-15 Thread Arne Babenhauserheide
Hi Tom, 

Am Samstag, 15. Oktober 2011, 10:09:24 schrieb Thomas S. Dye:
 Arne Babenhauserheide arne_...@web.de writes:
   Is there a way to get python3 support for Babel into org-mode
   cleanly?

 If your projects are in different files, then you should be able to use
 file variables:
 http://www.gnu.org/s/libtool/manual/emacs/Specifying-File-Variables.html#Spe
 cifying-File-Variables.
 
 Something like:
 -*- org-babel-python-command: python3

It works! Many thanks (this is damn cool!)

# -*- org-babel-python-command: python3; -*-

Best wishes, 
Arne

signature.asc
Description: This is a digitally signed message part.