emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] [BABEL] ob-rec.el and some questions


From: Jose E. Marchesi
Subject: Re: [Orgmode] [BABEL] ob-rec.el and some questions
Date: Tue, 15 Feb 2011 20:29:21 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux)

    > #+begin_src rec :data hackers.rec :fields Name,Email :type Hacker
    > Papers = 'requested' && CreatedAt << '01 January 2011'
    > #+end_src
    >
    
    Very cool!  Now is the time when I ask, would you consider adding this
    to the Org-mode core, which requires filling out the FSF copyright
    assignment form?  http://orgmode.org/worg/org-contribute.html#sec-2

Sure.  I assigned future changes to Emacs some years ago.

    >   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:
    >
    
    With my attached version of ob-rec.el it is possible to have a
    mostly empty body as follows, however, currently
    `org-babel-get-src-block-info' *does* require that there be at least
    1 character as well as a newline in the body.  This could be
    changed, however I'd want to do some local testing before pushing up
    such a change, as I fear it may break existing code blocks.

That looks like a reasonable workaround.

    > - 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.
    >
    
    Please see my attached revision of ob-rec.el.  I do not believe that the
    default value of raw is appropriate currently as Babel should know when
    the returned results are a table.  I've slightly modified your existing
    code so that raw is no longer the default value, and so that tables are
    passed back as tables.  Does this change subsume your format
    question?

Yes, now it is clear: I have to adapt the returned data to the
result-params settings, and not the other way around.

Thanks for the fixes :)
    
    Also, it sounds like there is currently only support for selecting
    records *from* a .rec file, do you plan on adding support for inserting
    records *into* a .rec file?

Extracting the records from org tables or raw rec data, you mean?  It
would be easy to use csv2rec and recins to implement a recins block:

#+begin_src recins :data foo.rec
| Title            | Author              |
| GNU Emacs Manual | Richard M. Stallman |
...
#+end_src

or

#+begin_src recins :data foo.rec
%rec: Book
...

Title: GNU Emacs Manual
Author: Richard M. Stallman

...
#+end_src

By evaluating all the code blocks in the file in a sequential way,
additional "rec" blocks could then be used to make (and publish)
selections of the table inserted above:

#+begin_src rec :data foo.rec
some selection expression
#+end_src

#+results
| Title            | Author              |
| ...              | ...                 |


That sounds like fun! org-mode could then be used as a GUI for recutils
:D

-- 
Jose E. Marchesi    address@hidden
GNU Project         http://www.gnu.org



reply via email to

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