emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Using org-babel in other modes?
@ 2011-10-09 21:44 Dave Abrahams
  2011-10-10  0:08 ` Bernt Hansen
  2011-10-10 14:41 ` Eric Schulte
  0 siblings, 2 replies; 6+ messages in thread
From: Dave Abrahams @ 2011-10-09 21:44 UTC (permalink / raw)
  To: emacs-orgmode


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

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

* Re: Using org-babel in other modes?
  2011-10-09 21:44 Using org-babel in other modes? Dave Abrahams
@ 2011-10-10  0:08 ` Bernt Hansen
  2011-10-10  0:52   ` Dave Abrahams
  2011-10-10  7:39   ` zwz
  2011-10-10 14:41 ` Eric Schulte
  1 sibling, 2 replies; 6+ messages in thread
From: Bernt Hansen @ 2011-10-10  0:08 UTC (permalink / raw)
  To: Dave Abrahams; +Cc: emacs-orgmode

Dave Abrahams <dave@boostpro.com> 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

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

* Re: Using org-babel in other modes?
  2011-10-10  0:08 ` Bernt Hansen
@ 2011-10-10  0:52   ` Dave Abrahams
  2011-10-10  1:00     ` Bernt Hansen
  2011-10-10  7:39   ` zwz
  1 sibling, 1 reply; 6+ messages in thread
From: Dave Abrahams @ 2011-10-10  0:52 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode


on Sun Oct 09 2011, Bernt Hansen <bernt-AT-norang.ca> 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

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

* Re: Using org-babel in other modes?
  2011-10-10  0:52   ` Dave Abrahams
@ 2011-10-10  1:00     ` Bernt Hansen
  0 siblings, 0 replies; 6+ messages in thread
From: Bernt Hansen @ 2011-10-10  1:00 UTC (permalink / raw)
  To: Dave Abrahams; +Cc: emacs-orgmode

Dave Abrahams <dave@boostpro.com> writes:

> on Sun Oct 09 2011, Bernt Hansen <bernt-AT-norang.ca> 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

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

* Re: Using org-babel in other modes?
  2011-10-10  0:08 ` Bernt Hansen
  2011-10-10  0:52   ` Dave Abrahams
@ 2011-10-10  7:39   ` zwz
  1 sibling, 0 replies; 6+ messages in thread
From: zwz @ 2011-10-10  7:39 UTC (permalink / raw)
  To: emacs-orgmode

Bernt Hansen <bernt@norang.ca> writes:

> Dave Abrahams <dave@boostpro.com> 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

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

* Re: Using org-babel in other modes?
  2011-10-09 21:44 Using org-babel in other modes? Dave Abrahams
  2011-10-10  0:08 ` Bernt Hansen
@ 2011-10-10 14:41 ` Eric Schulte
  1 sibling, 0 replies; 6+ messages in thread
From: Eric Schulte @ 2011-10-10 14:41 UTC (permalink / raw)
  To: Dave Abrahams; +Cc: emacs-orgmode

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 <dave@boostpro.com> 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/

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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-09 21:44 Using org-babel in other modes? Dave Abrahams
2011-10-10  0:08 ` Bernt Hansen
2011-10-10  0:52   ` Dave Abrahams
2011-10-10  1:00     ` Bernt Hansen
2011-10-10  7:39   ` zwz
2011-10-10 14:41 ` Eric Schulte

Code repositories for project(s) associated with this 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).