From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: org-babel language support Date: Tue, 20 Apr 2010 19:17:53 -0400 Message-ID: <87eii9emse.fsf@stats.ox.ac.uk> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O4MiF-0002vv-7i for emacs-orgmode@gnu.org; Tue, 20 Apr 2010 19:18:39 -0400 Received: from [140.186.70.92] (port=41352 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4MiC-0002rg-P8 for emacs-orgmode@gnu.org; Tue, 20 Apr 2010 19:18:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O4Mhd-0007Lm-CM for emacs-orgmode@gnu.org; Tue, 20 Apr 2010 19:18:03 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:35779) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O4Mhd-0007Ld-38 for emacs-orgmode@gnu.org; Tue, 20 Apr 2010 19:18:01 -0400 Received: from blackcap.stats.ox.ac.uk (blackcap.stats [163.1.210.5]) by markov.stats.ox.ac.uk (8.13.6/8.13.6) with ESMTP id o3KNHtks014277 for ; Wed, 21 Apr 2010 00:17:55 +0100 (BST) In-Reply-To: (Izaak Beekman's message of "Tue, 20 Apr 2010 14:26:04 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Izaak Beekman writes: > How much work is it to support a new compiled langauge?=C2=A0 I am intere= sted in > using org-babel for Fortran literate programming (LP).=C2=A0 I am new to = org-mode, > but know a little bit of e-lisp, and might start hacking at this after so= me > preliminary investigation.=C2=A0 The main functionality I am looking for = is pretty > printing documentation, and code export (tangling).=C2=A0 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 co= mment TYPE (string), INTENT(IN) :: s1, s2 TYPE (string) string_concat string_concat%string_data =3D s1%string_data(1:s1%length) // & s2%string_data(1:s2%length) ! This is a co= ntinuation string_concat%length =3D 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 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > 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