emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dima Kogan <lists@dima.secretsauce.net>
To: emacs-orgmode@gnu.org
Subject: Re: Adding new table rows/cols in a formula update
Date: Tue, 30 Sep 2014 12:27:52 -0700	[thread overview]
Message-ID: <87fvf8hpqw.fsf@secretsauce.net> (raw)
In-Reply-To: <87k34mgvup.fsf@secretsauce.net>

[-- Attachment #1: Type: text/plain, Size: 563 bytes --]

Dima Kogan <lists@dima.secretsauce.net> 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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-table-field-formulas-can-now-create-new-columns-.patch --]
[-- Type: text/x-diff, Size: 830 bytes --]

From 93e9927dd49d100036853963e899c8b6af5325de Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima@secretsauce.net>
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


  reply	other threads:[~2014-09-30 19:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-29 17:45 Adding new table rows/cols in a formula update Dima Kogan
2014-09-30 19:27 ` Dima Kogan [this message]
2014-09-30 19:54   ` Subhan Michael Tindall
2014-10-01  5:44     ` Dima Kogan
2014-10-01 19:38       ` Nicolas Goaziou
2014-10-01 19:38         ` Dima Kogan
2014-10-01 20:17         ` Nick Dokos
2014-10-03 18:07           ` Dima Kogan
2014-10-10 10:05             ` Nicolas Goaziou
2014-10-10 18:17               ` Dima Kogan
2014-10-11 13:09                 ` Bastien
2014-10-11 15:14                   ` Nicolas Goaziou
2014-10-11 17:02                     ` Dima Kogan
2014-10-12  9:18                       ` Nicolas Goaziou
2014-10-12 10:08                         ` Bastien
2014-10-12 12:06                           ` Nicolas Goaziou
2014-10-12 12:20                             ` Bastien
2014-10-13 17:14                       ` Achim Gratz
2014-12-08 19:50                         ` Achim Gratz

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=87fvf8hpqw.fsf@secretsauce.net \
    --to=lists@dima.secretsauce.net \
    --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).