Re: [O] Using org-babel in other modes?

2011-10-10 Thread Eric Schulte
Hi Dave,

Sadly I think the level of effort here is likely closer to "read the
code and figure it out" than to a quick <1hour effort.  I would have to
dig through the code to figure out exactly how difficult this would be,
but I would imagine that the different moving parts which make this work
in Org-mode are likely scattered in a couple of different places.

There is MuMaMo-mode which is not related to the Org-mode implementation
but is designed specifically for embedding multiple major modes into a
single mode.  However it can sometimes be hairy to configure and it
proved insufficient for the source-code-block highlighting in Org-mode.

Best -- Eric

Dave Abrahams  writes:

> Org-babel does a magic thing where you get to edit and view your source
> code blocks in their native modes.  Wow!
>
> I also happen to use markdown-mode to write blog articles.  How hard, on
> a scale from "read the source and figure it out" to "org-babel already
> has the hooks; you can do it in 5 minutes," would it be to integrate the
> org-babel stuff with markdown?
>
> Seems like this trick would be extremely useful for quite a few modes
> (RestructuredText, anyone?)
>
> Thanks,

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



Re: [O] Using org-babel in other modes?

2011-10-10 Thread zwz
Bernt Hansen  writes:

> Dave Abrahams  writes:
>
>> Org-babel does a magic thing where you get to edit and view your
> source
>> code blocks in their native modes.  Wow!
>>
>> I also happen to use markdown-mode to write blog articles. How hard,
> on
>> a scale from "read the source and figure it out" to "org-babel already
>> has the hooks; you can do it in 5 minutes," would it be to integrate
> the
>> org-babel stuff with markdown?
>>
>> Seems like this trick would be extremely useful for quite a few modes
>> (RestructuredText, anyone?)
>>
>> Thanks,
>
> Is it just a matter of defining the mode to use for some new source?
>
> For plantuml I have the following:
>
> (org-babel-do-load-languages
>  (quote org-babel-load-languages)
>  (quote ((emacs-lisp . t)
>(dot . t)
>(ditaa . t)
>(R . t)
>(python . t)
>(ruby . t)
>(gnuplot . t)
>(clojure . t)
>(sh . t)
>(ledger . t)
>(org . t)
>(plantuml . t)
>(latex . t
>
> (add-to-list 'org-src-lang-modes (quote ("plantuml" . fundamental)))
>
> This enables fundamental-mode when I C-c ' on a plantuml block
>
> #+begin_src plantuml :file foo.png
>
> #+end_src

Hey Bernt, there is a plantuml-mode. Just google it. ;)

>
>
> Does that help?
>
> Regards,
> Bernt




Re: [O] Using org-babel in other modes?

2011-10-09 Thread Bernt Hansen
Dave Abrahams  writes:

> on Sun Oct 09 2011, Bernt Hansen  wrote:
>
>> (add-to-list 'org-src-lang-modes (quote ("plantuml" . fundamental)))
>> This enables fundamental-mode when I C-c ' on a plantuml block
>> #+begin_src plantuml :file foo.png
>>
>> #+end_src
>> Does that help?
>
> I'm not sure... *looks up org-src-lang-modes* Oh, no I think you
> misunderstood me.  I am not trying to add an additional language
> recognizer to org-babel.
>
> Markdown is a plaintext document format roughly similar to Org.  What I
> want is to modify markdown-mode so that /its/ code blocks, which are
> currently recognized by markdown-mode but rendered in one solid face and
> without any language-specific editing smarts, behave like org's.

Ah, sorry I don't know how this is implemented in org (for the
fontification of source) so I can't help with making markdown-mode work
the way you want.

Regards,
Bernt



Re: [O] Using org-babel in other modes?

2011-10-09 Thread Dave Abrahams

on Sun Oct 09 2011, Bernt Hansen  wrote:

> Is it just a matter of defining the mode to use for some new source?

Sorry, I don't think I understand the question.

> For plantuml I have the following:
> (org-babel-do-load-languages
>  (quote org-babel-load-languages)
>  (quote ((emacs-lisp . t)
>(dot . t)
>(ditaa . t)
>(R . t)
>(python . t)
>(ruby . t)
>(gnuplot . t)
>(clojure . t)
>(sh . t)
>(ledger . t)
>(org . t)
>(plantuml . t)
>(latex . t
>
> (add-to-list 'org-src-lang-modes (quote ("plantuml" . fundamental)))
> This enables fundamental-mode when I C-c ' on a plantuml block
> #+begin_src plantuml :file foo.png
>
> #+end_src
> Does that help?

I'm not sure... *looks up org-src-lang-modes* Oh, no I think you
misunderstood me.  I am not trying to add an additional language
recognizer to org-babel.

Markdown is a plaintext document format roughly similar to Org.  What I
want is to modify markdown-mode so that /its/ code blocks, which are
currently recognized by markdown-mode but rendered in one solid face and
without any language-specific editing smarts, behave like org's.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com



Re: [O] Using org-babel in other modes?

2011-10-09 Thread Bernt Hansen
Dave Abrahams  writes:

> Org-babel does a magic thing where you get to edit and view your source
> code blocks in their native modes.  Wow!
>
> I also happen to use markdown-mode to write blog articles.  How hard, on
> a scale from "read the source and figure it out" to "org-babel already
> has the hooks; you can do it in 5 minutes," would it be to integrate the
> org-babel stuff with markdown?
>
> Seems like this trick would be extremely useful for quite a few modes
> (RestructuredText, anyone?)
>
> Thanks,

Is it just a matter of defining the mode to use for some new source?

For plantuml I have the following:

--8<---cut here---start->8---
(org-babel-do-load-languages
 (quote org-babel-load-languages)
 (quote ((emacs-lisp . t)
 (dot . t)
 (ditaa . t)
 (R . t)
 (python . t)
 (ruby . t)
 (gnuplot . t)
 (clojure . t)
 (sh . t)
 (ledger . t)
 (org . t)
 (plantuml . t)
 (latex . t

(add-to-list 'org-src-lang-modes (quote ("plantuml" . fundamental)))
--8<---cut here---end--->8---

This enables fundamental-mode when I C-c ' on a plantuml block

#+begin_src plantuml :file foo.png

#+end_src


Does that help?

Regards,
Bernt




[O] Using org-babel in other modes?

2011-10-09 Thread Dave Abrahams

Org-babel does a magic thing where you get to edit and view your source
code blocks in their native modes.  Wow!

I also happen to use markdown-mode to write blog articles.  How hard, on
a scale from "read the source and figure it out" to "org-babel already
has the hooks; you can do it in 5 minutes," would it be to integrate the
org-babel stuff with markdown?

Seems like this trick would be extremely useful for quite a few modes
(RestructuredText, anyone?)

Thanks,

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com