emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rainer M Krug <r.m.krug@gmail.com>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Re: [ANN] Org-babel integrated into Org-mode
Date: Mon, 28 Jun 2010 09:55:10 +0200	[thread overview]
Message-ID: <AANLkTimkZsL7CC6q1Gb62tgT53baQeKQis8DjAV6U2Pj@mail.gmail.com> (raw)
In-Reply-To: <87mxuji0n9.fsf@gmail.com>


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

On Fri, Jun 25, 2010 at 5:37 PM, Eric Schulte <schulte.eric@gmail.com>wrote:

> Hi Rainer,
>

Hi Eric


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

Sounds perfect.


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

OK - I understand that and it makes perfect sense.


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

Perfect.


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

That's perfect - it adds much flexibility, and to do it via header arguments
is absolutely perfect for me.


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

Wow - even better!


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

Good to know, but in general I am perfectly happy without shebang lines. But
there are cases, where they are necessary.


>
> 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
>  (require 'org-babel-init)
> that may by lying around your configuration.
>

OK - understood.


>
> Whew! that was alot of writing for a /simplification/ of configuration.
>

Well - but it made many things much clearer for me. It is often more
difficult to explain the changes which need to be made then to explain to a
new user how it should be done.


> Hopefully the example of your configuration below will be a more
> succinct demonstration of the needed transformations.
>
> Rainer M Krug <r.m.krug@gmail.com> 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
>

OK - done.


>
> >
> > *** 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
>

I don't seem to need this line anymore -  it is working without. Also, I
don't remember why I put it in...


> >
> > *** Customization of sh
> >   set shebang for sh script to "#!/bin/bash" and exclude additional
> comments
> > (t)
> > #+begin_src emacs-lisp
> >   (setq org-babel-tangle-langs
> >   (cons
> >   '("sh" "sh" "#!/bin/bash" t)
> >   (remove-if (lambda (el) (string= (car el) "sh"))
> org-babel-tangle-langs)))
> > #+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
>
> >
> > *** 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= (car el) "R"))
> org-babel-tangle-langs)))
> > #+end_src
> >
>
> the above can be omitted entirely
>
> If you've made it this far, then thanks for your patience,


I have to thank you for the patience to write such a clear description. I
must say I enjoyed reading it. I would actually suggest to put this up on
the WiKi for org-babel, as it can help change ones configuration, but also
to understand how to configure the integrated org-babel - Thanks a lot.


> and please let me know if you run into any problems with the above.
>

Thanks again - it is working.

 Just one additional question: When I go on the menu to Org -- Documentation
-- Info Documentation, I still get the info help from version 6.21b,
although I installed the version from git, and under Org -- Documentation --
Show Version it gives me "Org-mode version 6.36trans
(release_6.36.408.g7f21f)".

Can I change this somehow? It seems that the Info Documentation is the one
which is part of emacs.

Cheers,

Rainer


>
> Best -- Eric
>
> >
> > which custimizes the shebang creation and the comments in the tangled
> file.
> > Do I have to change any settings, and if yes, how? The previous
> conversation
> > seems to say "yes, it needs to be changed", but I don't understand what
> and
> > how.
> >
> >
> > Thanks,
> >
> > Rainer.
> > On Thu, Jun 24, 2010 at 6:27 PM, Eric Schulte <schulte.eric@gmail.com
> >wrote:
> >
> >> Hi Sébastien,
> >>
> >> Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
> >>
> >> [...]
> >> >
> >> > For my own understanding, what's the status of `Org-babel-screen', for
> >> which
> >> > I've never been able to understand completely all the differences with
> >> `sh' in
> >> > `Org-babel'?
> >> >
> >>
> >> I believe screen has more of a focus on sustained interaction with an
> >> interactive terminal, although to be honest I haven't really used it and
> >> can't say for sure.  Benjamin Andresen, the author, may have a more
> >> satisfying answer for you.
> >>
> >> >
> >> > Second, a problem with the following code:
> >> >
> >> >       ;; Org-babel needs to be told to recognize awk source code
> blocks
> >> and
> >> >       ;; how they should be tangled, which can be accomplished with
> the
> >> >       ;; following:
> >> >       (org-babel-add-interpreter "awk")
> >> >       (add-to-list 'org-babel-tangle-langs '("awk" "awk"))
> >> >
> >> >       (org-babel-add-interpreter "fortran")
> >> >       (add-to-list 'org-babel-tangle-langs '("fortran" "f"))
> >> >
> >> >       ;; ;; org-babel panics when trying to evaluate ruby code blocks
> >> because
> >> >       ;; ;; you don't have the required ruby executables available on
> >> your
> >> >       ;; ;; system. Probably the best way to deal with this is to
> remove
> >> ruby
> >> >       ;; ;; from the list of languages supported by babel:
> >> >       ;; (setq org-babel-interpreters (delete "ruby"
> >> org-babel-interpreters))
> >> >
> >> >       ;; make pre-built helper functions (`lob') available
> >> >       ;; (org-babel-load-library-of-babel)
> >> >
> >> >       ;; mapping between languages (listings in LaTeX) and their major
> >> mode
> >> >       ;; (in Emacs)
> >> >       (setq org-src-lang-modes
> >> >             '(("ocaml" . tuareg)
> >> >               ("elisp" . emacs-lisp)
> >> >               ;; ("Delphi" . perl)
> >> >               ("ditaa" . artist)
> >> >               ("asymptote" . asy)
> >> >               ("dot" . fundamental)))
> >> >       ;; )
> >> >
> >> > Neither org-babel-add-interpreter, neither its shorter version do
> exist
> >> now?
> >> >
> >>
> >> Yes, thanks for bringing this up! I realized last night that I forgot to
> >> mention this in the announcement.
> >>
> >> We have simplified the handling of languages in Org-babel, in that the
> >> org-babel-interpreters and org-babel-tangle-langs variables have both
> >> been removed.
> >>
> >> Rather than keeping explicit lists of supported languages, Babel will
> >> now try to work with every language, and will only give up if it can't
> >> find a needed function (e.g. if there is no org-babel-execute:foo
> >> function defined then babel will give up on evaluating a foo code
> >> block).  The only remaining language list is
> >> `org-babel-tangle-lang-exts' which can optionally be used to associate
> >> file extensions with language names, but is *not* required for
> >> evaluation or tangling.
> >>
> >> Given this, your configuration from above could be rewritten as
> >>
> >> --8<---------------cut here---------------start------------->8---
> >>       ;; Org-babel now needs less hand-holding :) however it could be
> >>      ;; useful to know extensions for some languages
> >>      (add-to-list 'org-babel-tangle-lang-exts '("fortran" . "f"))
> >>
> >>      ;; mapping between languages (listings in LaTeX) and their major
> mode
> >>      ;; (in Emacs)
> >>      (setq org-src-lang-modes
> >>            '(("ocaml" . tuareg)
> >>              ("elisp" . emacs-lisp)
> >>              ;; ("Delphi" . perl)
> >>              ("ditaa" . artist)
> >>              ("asymptote" . asy)
> >>              ("dot" . fundamental)))
> >>      ;; )
> >> --8<---------------cut here---------------end--------------->8---
> >>
> >> Cheers -- Eric
> >>
> >> >
> >> > Best regards,
> >> >   Seb
> >>
> >> _______________________________________________
> >> 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
> >>
>



-- 
NEW GERMAN FAX NUMBER!!!

Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Cell:           +27 - (0)83 9479 042
Fax:            +27 - (0)86 516 2782
Fax:            +49 - (0)321 2125 2244
email:          Rainer@krugs.de

Skype:          RMkrug
Google:         R.M.Krug@gmail.com

[-- Attachment #1.2: Type: text/html, Size: 17074 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

  parent reply	other threads:[~2010-06-28  7:55 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-23 21:09 [ANN] Org-babel integrated into Org-mode Eric Schulte
2010-06-23 23:23 ` Sebastian Rose
2010-06-23 23:41   ` Eric Schulte
2010-06-24  0:03 ` Bernt Hansen
2010-06-24  0:39   ` Eric Schulte
2010-06-24  5:12     ` Nathan Neff
2010-06-24  5:42       ` Eric Schulte
2010-06-24  7:31 ` Sébastien Vauban
2010-06-24 16:27   ` Eric Schulte
2010-06-25  8:28     ` Rainer M Krug
2010-06-25 15:37       ` Eric Schulte
2010-06-26  8:45         ` Štěpán Němec
2010-06-26 15:59           ` Eric Schulte
2010-06-26 16:30             ` Štěpán Němec
2010-06-26 17:27               ` Eric Schulte
2010-06-26 18:45                 ` Stephan Schmitt
2010-06-26 19:42               ` Carsten Dominik
2010-06-26 19:51                 ` Štěpán Němec
2010-06-28  7:55         ` Rainer M Krug [this message]
2010-06-28 11:53           ` Štěpán Němec
2010-06-28 12:16             ` Rainer M Krug
2010-06-28 12:54               ` Bernt Hansen
2010-06-28 13:18                 ` Rainer M Krug
2010-06-28 13:25                   ` Bernt Hansen
2010-06-28 13:36                     ` Rainer M Krug
2010-06-28 16:03           ` Eric Schulte
2010-06-29  7:11             ` Rainer M Krug
2010-06-28 11:32 ` Christopher Witte
2010-06-28 16:59   ` Eric Schulte
2010-07-02 15:50     ` Christopher Witte
2010-06-29 18:23 ` Matt Lundin
2010-06-29 19:08   ` Nick Dokos
2010-06-29 21:01     ` Matt Lundin
2010-06-29 21:27       ` Matthew Lundin
2010-06-29 22:12       ` Nick Dokos
2010-06-29 22:03   ` Eric Schulte
2010-06-29 23:09     ` Eric Schulte
2010-06-29 23:11       ` Eric Schulte
2010-06-30  2:21         ` Nick Dokos
2010-06-30  5:37           ` Eric Schulte
2010-06-30  5:40             ` Eric Schulte
2010-06-30 12:13     ` Matthew Lundin
2010-06-30  9:27   ` Carsten Dominik
2010-06-30  9:59     ` Scot Becker
2010-06-30 12:53     ` Matthew Lundin
2010-06-30 13:24       ` Carsten Dominik
2010-06-30 16:25     ` Eric Schulte
2010-06-30 17:01       ` Dan Davison
2010-06-30 17:17         ` Eric Schulte
2010-06-30 23:08           ` Stephan Schmitt
2010-07-01  0:20         ` Matthew Lundin
2010-07-01  6:27         ` Carsten Dominik
2010-07-01 16:11           ` Nick Dokos
2010-07-01 20:24             ` Sébastien Vauban
2010-07-01 22:14               ` Nick Dokos
2010-06-30 19:41       ` Eric Schulte
2010-07-01  7:20       ` Carsten Dominik
2010-07-01 14:55         ` Eric Schulte
2010-07-01 20:39           ` Eric Schulte
2010-07-01 22:13             ` Christian Moe
2010-07-02  4:22             ` Carsten Dominik
2010-07-02 18:52               ` Eric Schulte
2010-07-02  8:38           ` Carsten Dominik
2010-06-30 19:01   ` Eric Schulte
2010-06-30 20:47     ` Matthew Lundin

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=AANLkTimkZsL7CC6q1Gb62tgT53baQeKQis8DjAV6U2Pj@mail.gmail.com \
    --to=r.m.krug@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@gmail.com \
    /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).