emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] Proposal: In-place formulas in tables


From: Simon Winwood
Subject: [Orgmode] Proposal: In-place formulas in tables
Date: Mon, 07 May 2007 20:24:11 +1000
User-agent: WanderLust

       Hi, I recently got bitten (not badly, say nibbled then), when I
had a formula in a field to sum a column of numbers and added another
data row --- when I C-c C-c'd to update the sum, the last data row was
overwritten (i.e, not the formula field).

For example:

|---+---|
| a | 1 |
| b | 2 |
|---+---|
|   | 3 |
#+TBLFM: @3$2=vsum(@address@hidden)

add row X and recalculate (note b is overwritten by 1):
|---+---|
| a | 1 |
| X | 7 |
| b | 1 |
|---+---|
|   | 3 |
#+TBLFM: @3$2=vsum(@address@hidden)

       Obviously the code is doing the right thing according to the
TBLFM rules, it just isn't what I (and, I assume, other people) would
expect.

       So, a solution: rather than overwrite formulas in fields with
their values, use overlays to make the formula invisible and set
before-string (or after-string) to be the calculated value.  

    Issues: 
    
       * You probably want to enable toggling of invisibility, and
       somehow mark values as calc-values.  Maybe have a command to
       edit field formulas in the minibuffer?

       * The code to align tables would need to take into
       consideration the values in the overlay, not the text.
       
       * Ditto for calculating values

       * Cut-and-paste of tables doesn't give you what you expect
       (i.e., you still have formulas, not values)

    Comments?  I could probably hack this in, but someone who knows
    the code could do it in a few hours (if that) and better than I.
         
         Simon




reply via email to

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