emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Wish: babel for python3
@ 2011-10-14 14:42 Arne Babenhauserheide
  2011-10-15 18:36 ` Eric Schulte
  0 siblings, 1 reply; 7+ messages in thread
From: Arne Babenhauserheide @ 2011-10-14 14:42 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Wish: babel for python3
  2011-10-14 14:42 Wish: babel for python3 Arne Babenhauserheide
@ 2011-10-15 18:36 ` Eric Schulte
  2011-10-15 18:52   ` Arne Babenhauserheide
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Schulte @ 2011-10-15 18:36 UTC (permalink / raw)
  To: arne_bab; +Cc: emacs-orgmode

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_bab@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/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Wish: babel for python3
  2011-10-15 18:36 ` Eric Schulte
@ 2011-10-15 18:52   ` Arne Babenhauserheide
  2011-10-15 20:09     ` Thomas S. Dye
  0 siblings, 1 reply; 7+ messages in thread
From: Arne Babenhauserheide @ 2011-10-15 18:52 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 878 bytes --]

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_bab@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


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 316 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Wish: babel for python3
  2011-10-15 18:52   ` Arne Babenhauserheide
@ 2011-10-15 20:09     ` Thomas S. Dye
  2011-10-15 20:29       ` Arne Babenhauserheide
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas S. Dye @ 2011-10-15 20:09 UTC (permalink / raw)
  To: Arne Babenhauserheide; +Cc: emacs-orgmode

Arne Babenhauserheide <arne_bab@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_bab@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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Wish: babel for python3
  2011-10-15 20:09     ` Thomas S. Dye
@ 2011-10-15 20:29       ` Arne Babenhauserheide
  2011-10-18  8:56         ` Torsten Wagner
  0 siblings, 1 reply; 7+ messages in thread
From: Arne Babenhauserheide @ 2011-10-15 20:29 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 579 bytes --]

Hi Tom, 

Am Samstag, 15. Oktober 2011, 10:09:24 schrieb Thomas S. Dye:
> Arne Babenhauserheide <arne_bab@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

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 316 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Wish: babel for python3
  2011-10-15 20:29       ` Arne Babenhauserheide
@ 2011-10-18  8:56         ` Torsten Wagner
  2011-10-18 12:13           ` Rasmus
  0 siblings, 1 reply; 7+ messages in thread
From: Torsten Wagner @ 2011-10-18  8:56 UTC (permalink / raw)
  To: Arne Babenhauserheide; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Wish: babel for python3
  2011-10-18  8:56         ` Torsten Wagner
@ 2011-10-18 12:13           ` Rasmus
  0 siblings, 0 replies; 7+ messages in thread
From: Rasmus @ 2011-10-18 12:13 UTC (permalink / raw)
  To: emacs-orgmode

Torsten Wagner <torsten.wagner@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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-10-18 12:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-14 14:42 Wish: babel for python3 Arne Babenhauserheide
2011-10-15 18:36 ` Eric Schulte
2011-10-15 18:52   ` Arne Babenhauserheide
2011-10-15 20:09     ` Thomas S. Dye
2011-10-15 20:29       ` Arne Babenhauserheide
2011-10-18  8:56         ` Torsten Wagner
2011-10-18 12:13           ` Rasmus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).