emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Wishlist: allow range of table elements to be filled by sbe


From: Eric Schulte
Subject: Re: [O] Wishlist: allow range of table elements to be filled by sbe
Date: Fri, 19 Aug 2011 16:22:40 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Hi András,

András Major <address@hidden> 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=this-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ás
>
>
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



reply via email to

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