[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] [BABEL] ob-rec.el and some questions
From: |
Jose E. Marchesi |
Subject: |
[Orgmode] [BABEL] ob-rec.el and some questions |
Date: |
Mon, 14 Feb 2011 22:07:29 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux) |
Hi.
I have been playing a bit with org babel, the goal being to be able to
query a recfile[1] and insert the result as a rec table. Thanks to the
superb design of org-babel and the existing examples, I quickly wrote
the attached little hack.
The hack allows to query a rec file 'foo.rec' as follows:
#+begin_src rec :data hackers.rec :fields Name,Email :type Hacker
Papers = 'requested' && CreatedAt << '01 January 2011'
#+end_src
Where :data points to the recfile (or list of files), :fields is a
comma-separated list of fields (allowing subscripts) and :type selects
the record set where to make the query. :cmdline can also be used to
specify any other command line option to recsel. All parameters but
:data are optional.
The selection expression can be any expression allowed by recsel in the
-e command line option.
Of course you have to install the recutils for it to work.
It roughly works and I want to add more functionality, but due to my
lack of experience with org-babel I would like to ask some questions
before continuing working on it.
- Is there a way to execute empty code blocks? It would be quite common
to require all the records stored in a record set, e.g.
#+begin_src rec :data inventory.rec
#+end_src
C-cC-c in that block echoes "Local setup has been refreshed" and
nothing happens. A workaround would be to use a selection expression
that always evaluates to "true", such as:
#+begin_src rec :data inventory.rec
1
#+end_src
but it would be nice to avoid it.
- Is there a way to dinamically change the value of the :results
parameter in the org-babel-execute:rec function? I would like to add
a :template parameter containing a template for recfmt, and in that
case the default value "raw" would not be appropriate.
Thanks in advance :)
[1] http://www.gnu.org/software/recutils
ob-rec.el
Description: ob-rec.el
--
Jose E. Marchesi address@hidden
GNU Project http://www.gnu.org
- [Orgmode] [BABEL] ob-rec.el and some questions,
Jose E. Marchesi <=