From mboxrd@z Thu Jan 1 00:00:00 1970 From: jemarch@gnu.org (Jose E. Marchesi) Subject: Re: [BABEL] ob-rec.el and some questions Date: Tue, 15 Feb 2011 20:29:21 +0100 Message-ID: <87zkpxm6zy.fsf@gnu.org> References: <877hd2uxym.fsf@gnu.org> <87sjvp5dzr.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=43751 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PpQg9-0003TR-Pv for emacs-orgmode@gnu.org; Tue, 15 Feb 2011 14:35:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PpQg6-0005q7-IN for emacs-orgmode@gnu.org; Tue, 15 Feb 2011 14:35:17 -0500 Received: from fencepost.gnu.org ([140.186.70.10]:57483) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PpQg6-0005q1-Ei for emacs-orgmode@gnu.org; Tue, 15 Feb 2011 14:35:14 -0500 In-Reply-To: <87sjvp5dzr.fsf@gmail.com> (Eric Schulte's message of "Tue, 15 Feb 2011 11:35:15 -0700") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: emacs-orgmode@gnu.org > #+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