emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Simon Winwood <sjw@cse.unsw.edu.au>
To: emacs-orgmode@gnu.org
Subject: Proposal: In-place formulas in tables
Date: Mon, 07 May 2007 20:24:11 +1000	[thread overview]
Message-ID: <1070507102511.9304@cse.unsw.edu.au> (raw)


       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(@1$2..@-I$2)

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

       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	other threads:[~2007-05-07 10:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-07 10:24 Simon Winwood [this message]
2007-05-07 11:45 ` Proposal: In-place formulas in tables Carsten Dominik

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=1070507102511.9304@cse.unsw.edu.au \
    --to=sjw@cse.unsw.edu.au \
    --cc=emacs-orgmode@gnu.org \
    /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).