From: Dan Davison <davison@stats.ox.ac.uk>
To: emacs-orgmode@gnu.org
Subject: Re: org-babel language support
Date: Tue, 20 Apr 2010 19:17:53 -0400 [thread overview]
Message-ID: <87eii9emse.fsf@stats.ox.ac.uk> (raw)
In-Reply-To: <x2k93f264081004201126v5c27af0cwc5d03d1796a6596a@mail.gmail.com> (Izaak Beekman's message of "Tue, 20 Apr 2010 14:26:04 -0400")
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
prev parent reply other threads:[~2010-04-20 23:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-20 18:26 org-babel language support Izaak Beekman
2010-04-20 23:17 ` Dan Davison [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87eii9emse.fsf@stats.ox.ac.uk \
--to=davison@stats.ox.ac.uk \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).