emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: jemarch@gnu.org (Jose E. Marchesi)
To: Eric Schulte <schulte.eric@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BABEL] ob-rec.el and some questions
Date: Tue, 15 Feb 2011 20:29:21 +0100	[thread overview]
Message-ID: <87zkpxm6zy.fsf@gnu.org> (raw)
In-Reply-To: <87sjvp5dzr.fsf@gmail.com> (Eric Schulte's message of "Tue, 15 Feb 2011 11:35:15 -0700")


    > #+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    jemarch@gnu.org
GNU Project         http://www.gnu.org

  reply	other threads:[~2011-02-15 19:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-14 21:07 [BABEL] ob-rec.el and some questions Jose E. Marchesi
2011-02-15 18:35 ` Eric Schulte
2011-02-15 19:29   ` Jose E. Marchesi [this message]
2011-02-15 20:35     ` Eric Schulte
2011-02-15 21:05       ` Jose E. Marchesi

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=87zkpxm6zy.fsf@gnu.org \
    --to=jemarch@gnu.org \
    --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).