From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: [ANN] Org-babel integrated into Org-mode Date: Sat, 26 Jun 2010 10:45:50 +0200 Message-ID: <87zkyiuqpt.fsf@gmail.com> References: <87wrtp78rg.fsf@gmail.com> <87aaqkvqdi.fsf@mundaneum.com> <87iq585rb9.fsf@gmail.com> <87mxuji0n9.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=58429 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OSR25-0004G3-BM for emacs-orgmode@gnu.org; Sat, 26 Jun 2010 04:46:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OSR23-0000Se-AF for emacs-orgmode@gnu.org; Sat, 26 Jun 2010 04:46:37 -0400 Received: from mail-fx0-f41.google.com ([209.85.161.41]:34191) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OSR23-0000SQ-0o for emacs-orgmode@gnu.org; Sat, 26 Jun 2010 04:46:35 -0400 Received: by fxm17 with SMTP id 17so435854fxm.0 for ; Sat, 26 Jun 2010 01:46:34 -0700 (PDT) In-Reply-To: <87mxuji0n9.fsf@gmail.com> (Eric Schulte's message of "Fri, 25 Jun 2010 08:37:30 -0700") 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: Eric Schulte Cc: emacs-orgmode@gnu.org, Rainer M Krug "Eric Schulte" writes: > Hi Rainer, > > First I'll give some expanded instructions in the hopes of helping out > anyone else affected by my lack of good instructions in the announcement > email. Then I'll provide a re-write of your config below as an example. > > Babel took the integration into Org-mode as an opportunity to do some > much needed house cleaning. Most importantly we have cleared out > unnecessary configuration variables -- which is great unless you already > have these variables set. > > We have eliminated the two main internal lists of languages, namely > - org-babel-interpreters and > - org-babel-tangle-langs > so any config lines which mention those variables, can/should be > stripped out in their entirety. This includes any calls to the > `org-babl-add-interpreter' function, whose sole purpose was to add > languages to the org-babel-interpreters variable. > > alright, so with those calls stripped out, we may still in some cases > want to associate a file name extension with certain languages, for > example we want all of our emacs-lisp files to end in a ".el", we can do > this will the `org-babel-tangle-lang-exts' variable. In general you > shouldn't need to touch this as it already has defaults for most common > languages, and if a language is not present in org-babel-tangle-langs, > then babel will just use the language name, so for example a file of c > code will have a ".c" extension by default, sh code will have a ".sh" > extension ect... > > You also mentioned shebang lines. This configuration now lives in > header arguments. So the shebang for a single file can be set at the > code block level, e.g. > > #+begin_src clojure :shebang #!/usr/bin/env clj > (println "with a shebang line, I can be run as a script!") > #+end_src > > note that whenever a file is tangled which includes a shebang line, > org-babel will make the file executable, so there is good reason to only > add shebangs at the source-code level. However if you're sure that you > want all of your code in some language (say shell scripts) to tangle out > with shebang lines, then you can customize the default header arguments > for that language, e.g. > > ;; ensure this variable is defined defined > (unless (boundp 'org-babel-default-header-args:sh) > (setq org-babel-default-header-args:sh '())) > > ;; add a default shebang header argument > (add-to-list 'org-babel-default-header-args:sh > '(:shebang . "#!/bin/bash")) > > The final change, is that to conform to Emacs guidelines, the prefix > org-babel-* in all require lines, has been changed to ob-*, also, since > Babel now loads by default with Org-mode you can remove any > (require 'org-babel) > or=20 > (require 'org-babel-init) > that may by lying around your configuration. > > Whew! that was alot of writing for a /simplification/ of configuration. > Hopefully the example of your configuration below will be a more > succinct demonstration of the needed transformations. > > Rainer M Krug writes: > >> Hi >> >> First of all thanks for integrating Org-babel into Org-mode. >> >> But for the less fluent elisp and org-mode users, I am slightly confused= in >> the changes necessary on my side. >> >> I have the following in my emacs.org file: >> >> >> #+begin_src emacs-lisp >> (require 'org-babel-R) ;; requires R and ess-mode >> ;; (require 'org-babel-ruby) ;; requires ruby, irb, ruby-mode, and >> inf-ruby >> (require 'org-babel-python) ;; requires python, and python-mode >> ;; (require 'org-babel-clojure) ;; requires clojure, clojure-mode, >> swank-clojure and slime >> #+end_src > > the above becomes > > #+begin_src emacs-lisp > (require 'ob-R) > ;; (require 'ob-ruby) > (require 'ob-python) > ;; (require 'ob-clojure) > #+end_src > >>=20 >> *** Start babel >> #+begin_src emacs-lisp >> (org-babel-load-library-of-babel) >> #+end_src > > the above becomes > > #+begin_src emacs-lisp > (org-babel-lob-ingest "~/path/to/org/contrib/babel/library-of-babel.org= ") > #+end_src > >>=20 >> *** Customization of sh >> set shebang for sh script to "#!/bin/bash" and exclude additional commen= ts >> (t) >> #+begin_src emacs-lisp >> (setq org-babel-tangle-langs >> (cons >> '("sh" "sh" "#!/bin/bash" t) >> (remove-if (lambda (el) (string=3D (car el) "sh")) org-babel-tangle-lang= s))) >> #+end_src > > #+begin_src emacs-lisp > ;; ensure this variable is defined defined > (unless (boundp 'org-babel-default-header-args:sh) > (setq org-babel-default-header-args:sh '())) > > ;; add a default shebang header argument > (add-to-list 'org-babel-default-header-args:sh > '(:shebang . "#!/bin/bash")) > #+end_src > >>=20 >> *** Customization of R >> set shebang for R script to "" and exclude additional comments (t) >> #+begin_src emacs-lisp >> (setq org-babel-tangle-langs >> (cons >> '("R" "R") >> (remove-if (lambda (el) (string=3D (car el) "R")) org-babel-tangle-lan= gs))) >> #+end_src >> > > the above can be omitted entirely > > If you've made it this far, then thanks for your patience, and please > let me know if you run into any problems with the above. > > Best -- Eric How come some of your rewrites above still use the `org-babel-' prefix? (As a side note, I don't see what Emacs guidelines suggest `ob-' is more appropriate than `org-babel-', and I would personally prefer to retain the latter -- it's much more descriptive.) =C5=A0t=C4=9Bp=C3=A1n [snip]