[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [O] Adding new table rows/cols in a formula update

**From**: |
Dima Kogan |

**Subject**: |
Re: [O] Adding new table rows/cols in a formula update |

**Date**: |
Tue, 30 Sep 2014 12:27:52 -0700 |

Dima Kogan <address@hidden> writes:
>* Suppose I have this .org file:*
>
>* | |*
>* #+TBLFM: @1$2=5*
>
>* It's a 1x1 table with a formula. The formula sets a cell that's out of*
>* bounds in the table, so evaluating this formula results in an error. How*
>* set-in-stone is this behavior? I haven't dug too deeply into the code,*
>* but are there fundamental assumptions here? Would a patch that extends*
>* the table before applying such a formula be too naive in some way?*
Here's a tiny patch that adds the columns (not rows) as needed. Is this
reasonable?

>*From 93e9927dd49d100036853963e899c8b6af5325de Mon Sep 17 00:00:00 2001*
From: Dima Kogan <address@hidden>
Date: Tue, 30 Sep 2014 12:27:26 -0700
Subject: [PATCH] org-table: field formulas can now create new columns as
needed
---
lisp/org-table.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 7607ead..31365ad 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -3125,7 +3125,7 @@ known that the table will be realigned a little later
anyway."
(while (setq eq (pop eqlname1))
(message "Re-applying formula to field: %s" (car eq))
(org-goto-line (nth 1 eq))
- (org-table-goto-column (nth 2 eq))
+ (org-table-goto-column (nth 2 eq) nil 'force)
(org-table-eval-formula nil (nth 3 eq) 'noalign 'nocst
'nostore 'noanalysis))
--
2.0.0