From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Winwood Subject: Proposal: In-place formulas in tables Date: Mon, 07 May 2007 20:24:11 +1000 Message-ID: <1070507102511.9304@cse.unsw.edu.au> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Hl0WD-0001kk-IG for emacs-orgmode@gnu.org; Mon, 07 May 2007 06:32:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Hl0WA-0001e2-Jv for emacs-orgmode@gnu.org; Mon, 07 May 2007 06:32:36 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hl0W9-0001an-QS for emacs-orgmode@gnu.org; Mon, 07 May 2007 06:32:33 -0400 Received: from note.orchestra.cse.unsw.edu.au ([129.94.242.24]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Hl0PB-00041k-1f for emacs-orgmode@gnu.org; Mon, 07 May 2007 06:25:21 -0400 Received: From smtp-dist.unsw.edu.au ([149.171.97.17] == smtp-dist-02.services.comms.unsw.EDU.AU) (for ) By note With Smtp ; Mon, 7 May 2007 20:25:13 +1000 Received: From butters.cse.unsw.edu.au ([220.233.12.16] == 16.12.233.220.exetel.com.au) (auth-user sjw) (cse-authentic-sender sjw) (for ) By tone With Smtp ; Mon, 7 May 2007 20:25:12 +1000 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: emacs-orgmode@gnu.org 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