emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Babel-tables: need to enable language to pass tables to code blocks
@ 2012-08-18 13:13 Luis Muñiz
  0 siblings, 0 replies; only message in thread
From: Luis Muñiz @ 2012-08-18 13:13 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-08-18 13:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-18 13:13 Babel-tables: need to enable language to pass tables to code blocks Luis Muñiz

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