emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Babel-tables: need to enable language to pass tables to code blocks


From: Luis Muñiz
Subject: [O] Babel-tables: need to enable language to pass tables to code blocks
Date: Sat, 18 Aug 2012 15:13:38 +0200

Hi!  I've started using tables to provide data to my babel-embedded
scripts, and I've found some issues.  The first one is that table data
is embedded in tangled scripts only if the source language has been
enabled for <a href="http://orgmode.org/org.html#Languages";>evaluation</a>.

That is, given a sample table:
#+TBLNAME: sample-table
| n | 2**n | 3**n |
|---+------+------|
| 1 |    2 |    3 |
| 2 |    4 |    9 |

...the next block is supposed to create a file with the table in it
when tangled, but it doesn't...
#+BEGIN_SRC sh :var data=sample-table :tangle yes
  :
#+END_SRC

... unless =sh= has been enabled for evaluation (by default, only
=emacs-lisp= is).

One can simply overcome this by first evaluating this block [fn:1]:
#+NAME: sh-activate
#+BEGIN_SRC emacs-lisp :results silent
  (org-babel-do-load-languages 'org-babel-load-languages '((sh . t))
  )
#+END_SRC

While this is not a serious problem it took me by surprise; I don't
know if it *really* has to be fixed (I'm unsure if this is a bug or a
feature ;) but, at least, it should appear in the documentation; may I
suggest <a href="http://orgmode.org/org.html#var";>here</a>, under the
`table' heading?

 I'm using org-mode version 7.8.11 from the GIT repository (updated
yesterday release_7.8.11-505-g952d72), and Emacs 23.2.1.

TIA,
--
  - Luis Muñiz

[fn:1] BTW, I've found a simpler way to achieve the same results by
using file variables:
#+ -*- mode: org; eval: (let () (org-babel-goto-named-src-block
"sh-activate") (org-babel-execute-src-block) (org-babel-tangle)) -*-



reply via email to

[Prev in Thread] Current Thread [Next in Thread]