From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: org-table-store-formulas bug Date: Sat, 28 Apr 2012 09:42:05 -0500 Message-ID: <878vhfsyte.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:47136) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SO8qi-00055U-1Q for emacs-orgmode@gnu.org; Sat, 28 Apr 2012 10:42:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SO8qg-0002l0-Db for emacs-orgmode@gnu.org; Sat, 28 Apr 2012 10:42:11 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:57804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SO8qg-0002kv-2U for emacs-orgmode@gnu.org; Sat, 28 Apr 2012 10:42:10 -0400 Received: from compute3.internal (compute3.nyi.mail.srv.osa [10.202.2.43]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id EFC1220D33 for ; Sat, 28 Apr 2012 10:42:07 -0400 (EDT) Received: from archeee (c-98-213-43-118.hsd1.il.comcast.net [98.213.43.118]) by mail.messagingengine.com (Postfix) with ESMTPSA id 66F338E0249 for ; Sat, 28 Apr 2012 10:42:07 -0400 (EDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org 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