emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-table-store-formulas bug
@ 2012-04-28 14:42 Matt Lundin
  2012-04-28 21:35 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Matt Lundin @ 2012-04-28 14:42 UTC (permalink / raw)
  To: Org Mode

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: org-table-store-formulas bug
  2012-04-28 14:42 org-table-store-formulas bug Matt Lundin
@ 2012-04-28 21:35 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2012-04-28 21:35 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Org Mode

Hi Matt,

Matt Lundin <mdl@imapmail.org> writes:

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

Fixed.  Thanks for reporting this!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-28 21:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-28 14:42 org-table-store-formulas bug Matt Lundin
2012-04-28 21:35 ` Bastien

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).