emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Lundin <mdl@imapmail.org>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: org-table-store-formulas bug
Date: Sat, 28 Apr 2012 09:42:05 -0500	[thread overview]
Message-ID: <878vhfsyte.fsf@fastmail.fm> (raw)

The following commit introduced a bug that prevents org-table from
evaluating formulas inserted into fields:

1c203d8d196aa9b46ea9a455cb891fefe2179d52

Steps to replicate:

1. Enter a simple table:

| 3 |
| 2 |
|---|
|   |

2. Add a formula:

| 3 |
| 2 |
|---|
| :=@1+@2 |

3. Press tab to evaluate:

Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
  org-table-store-formulas((("@3$1" . #("@1+@2" 0 5 (face org-formula fontified t)))))
  org-table-get-formula(#("@1+@2" 0 5 (face org-formula fontified t)) t)
  org-table-eval-formula((4) #("@1+@2" 0 5 (face org-formula fontified t)))
  org-table-maybe-eval-formula()
  org-table-next-field()
  call-interactively(org-table-next-field)
  org-cycle(nil)
  call-interactively(org-cycle nil nil)

The problem is the if statement in org-table-store-formulas:

    (if (looking-at "\\([ \t]*\n\\)*[ \t]*\\(#\\+tblfm:\\)\\(.*\n?\\)")
	(progn
	  ;; don't overwrite TBLFM, we might use text properties to store stuff
	  (goto-char (match-beginning 3))
	  (delete-region (match-beginning 3) (match-end 0)))
      (org-indent-line-function)
      (insert (match-string 2)))

Notice the (insert (match-string 2)). This fails because if there is
no looking-at match, then there will be no (match-string 2).

Best,
Matt

             reply	other threads:[~2012-04-28 14:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-28 14:42 Matt Lundin [this message]
2012-04-28 21:35 ` org-table-store-formulas bug Bastien

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=878vhfsyte.fsf@fastmail.fm \
    --to=mdl@imapmail.org \
    --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).