From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Wishlist: allow range of table elements to be filled by sbe Date: Fri, 19 Aug 2011 16:22:40 -0600 Message-ID: <87vctqbpgg.fsf@gmail.com> References: <878vqpo39j.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:49322) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvCZ7-00077W-0D for emacs-orgmode@gnu.org; Sun, 21 Aug 2011 14:16:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QvCZ5-0003tu-Jv for emacs-orgmode@gnu.org; Sun, 21 Aug 2011 14:16:08 -0400 Received: from mail-iy0-f175.google.com ([209.85.210.175]:50445) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvCZ5-0003tj-Aj for emacs-orgmode@gnu.org; Sun, 21 Aug 2011 14:16:07 -0400 Received: by iyn15 with SMTP id 15so7509633iyn.6 for ; Sun, 21 Aug 2011 11:16:05 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: =?utf-8?Q?Andr=C3=A1s?= Major Cc: emacs-orgmode@gnu.org Hi Andr=C3=A1s, Andr=C3=A1s Major writes: > Hi Eric, > >> sbe is just an elisp function which is called by the Org-mode >> spreadsheet's function evaluation mechanisms. The spreadsheet does not >> allow for insertion of results into multiple cells and thus neither does >> the use of sbe. > > Hmmm. It appears that one can make sbe set multiple cells in the > table -- simply make your code block output multiple results separated > by "|" and set ":results table". This, however, also shifts any > existing cells in the table, thus increasing the number of columns, > instead of just overwriting the given number of cells. > >> I would recommend a solution like the following, which >> reads the /entire/ table into a code block, and writes the results out >> in place. > > This isn't always practical. In the case of the Org document I'm > writing at the moment, the computation is rather expensive, and my > goal is that you can edit a row in the table and run the calculation > just for that row to see the result. Updating the entire table at > once would be much too slow. > Unfortunately I don't believe there is a good solution to this problem. > >> Every time the code block is evaluated multiple cells in the table are >> changed. To only set specific table values use of the `setf' macro >> would probably be more appropriate. > > How is setf used? I haven't found it in the documentation. > Setf can be used to update internal parts of a data structure, for example. #+results: this-is-another-table | 0 | 0 | 0 | | 0 | 0 | 0 | | 0 | 0 | 0 | #+source: this-is-another-table #+begin_src emacs-lisp :var table=3Dthis-is-another-table (setf (nth 1 table) '(2 2 2)) table #+end_src executing the code block will set the second row of the table to all twos. Hope this helps -- Eric > > Andr=C3=A1s > > > --=20 Eric Schulte http://cs.unm.edu/~eschulte/