emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-babel language support
@ 2010-04-20 18:26 Izaak Beekman
  2010-04-20 23:17 ` Dan Davison
  0 siblings, 1 reply; 2+ messages in thread
From: Izaak Beekman @ 2010-04-20 18:26 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 608 bytes --]

How much work is it to support a new compiled langauge?  I am interested in
using org-babel for Fortran literate programming (LP).  I am new to
org-mode, but know a little bit of e-lisp, and might start hacking at this
after some preliminary investigation.  The main functionality I am looking
for is pretty printing documentation, and code export (tangling).

Izaak Beekman
===================================
Princeton University Doctoral Candidate
Mechanical and Aerospace Engineering
ibeekman@princeton.edu

UMD-CP Visiting Graduate Student
Aerospace Engineering
ibeekman@umiacs.umd.edu
ibeekman@umd.edu

[-- Attachment #1.2: Type: text/html, Size: 795 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: org-babel language support
  2010-04-20 18:26 org-babel language support Izaak Beekman
@ 2010-04-20 23:17 ` Dan Davison
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Davison @ 2010-04-20 23:17 UTC (permalink / raw)
  To: emacs-orgmode

Izaak Beekman <ibeekman@umiacs.umd.edu> writes:

> How much work is it to support a new compiled langauge?  I am interested in
> using org-babel for Fortran literate programming (LP).  I am new to org-mode,
> but know a little bit of e-lisp, and might start hacking at this after some
> preliminary investigation.  The main functionality I am looking for is pretty
> printing documentation, and code export (tangling). 

Hi Izaak,

If you are just after export and tangling then you are in luck.

Prior to Org-babel, Org-mode already supported pretty fontified export
of code in any language that emacs understands. Use C-e for the export
dispatcher, which leads to e.g. html and latex export.

And to get tangling working for fortran, once org-babel is installed all
you need is

  (org-babel-add-interpreter "fortran")
  (add-to-list 'org-babel-tangle-langs '("fortran" "f"))

Here's the fortran src block I just tested. C-e b should bring up a
browser tab showing fontified code. You need to have the htmlize emacs
package loaded, which is in the org-mode contrib dir. And M-x
org-babel-tangle should create a fortran file containing the code, with
the .f extension replacing .org.

* fortran
  Some fortran code taken from Wikipedia
#+begin_src fortran :tangle yes
  FUNCTION string_concat(s1, s2)                             ! This is a comment
     TYPE (string), INTENT(IN) :: s1, s2
     TYPE (string) string_concat
     string_concat%string_data = s1%string_data(1:s1%length) // &
        s2%string_data(1:s2%length)                          ! This is a continuation
     string_concat%length = s1%length + s2%length
  END FUNCTION string_concat
#+end_src

A couple of points about export: for CSS control over the html produced,
see the variables org-export-htmlize-output-type and
org-export-html-style. For latex, one can get fontified code by
including the listings package. See section 11.3 Literal Examples of the
manual.

As for full org-babel support for fortran, Eric Schulte (the main
org-babel author) has recently added support for compilation and
execution of C and C++, so you would definitely want to take a look at
org-babel-C.el (if you haven't already). He may have further advice.

Dan




>
> Izaak Beekman
> ===================================
> Princeton University Doctoral Candidate
> Mechanical and Aerospace Engineering
> ibeekman@princeton.edu
>
> UMD-CP Visiting Graduate Student
> Aerospace Engineering
> ibeekman@umiacs.umd.edu
> ibeekman@umd.edu
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2010-04-20 23:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-20 18:26 org-babel language support Izaak Beekman
2010-04-20 23:17 ` Dan Davison

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).