From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Seltenreich Subject: [PATCH] Avoid parsing Calc's HMS forms as ranges Date: Wed, 15 Oct 2008 12:34:06 +0200 Message-ID: <87prm2du5d.fsf@gate450.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kq3hm-0006Gl-7e for emacs-orgmode@gnu.org; Wed, 15 Oct 2008 06:34:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kq3hk-0006EC-8Y for emacs-orgmode@gnu.org; Wed, 15 Oct 2008 06:34:13 -0400 Received: from [199.232.76.173] (port=50898 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kq3hk-0006DL-3f for emacs-orgmode@gnu.org; Wed, 15 Oct 2008 06:34:12 -0400 Received: from smtp1.rz.uni-karlsruhe.de ([129.13.185.217]:34117) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kq3hj-0001lq-1v for emacs-orgmode@gnu.org; Wed, 15 Oct 2008 06:34:11 -0400 Received: from uwi7 by rzstud2.stud.uni-karlsruhe.de with local (Exim 4.63) (envelope-from ) id 1Kq3hf-0001fQ-Pq for emacs-orgmode@gnu.org; Wed, 15 Oct 2008 12:34:08 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi, I just tried to do the following computation using Calc's HMS forms in an Org table, but Org got stuck in an endless loop when computing the last row. --8<---------------cut here---------------start------------->8--- | samples | mean | stddev | |----------------------------------------+-------------------+-----------| | [11'10, 9'55, 9'7, 10'45, 10'14, 9'29] | 0@ 10' 6.6666667" | 46.150479 | | [6'37, 6'18, 7'31, 7'45, 7'35, 6'25] | 0@ 7' 1.8333333" | 39.265337 | | [10'8, 9'48, 9'50] | 0@ 9' 55.333333" | 11.015141 | |----------------------------------------+-------------------+-----------| | | 0@ 27' 2.8027" | 61.587066 | #+TBLFM: $2=vmean(@$-1/1")*1"::$3=vsdev(@$-2/1")::@5$2=vsum(@-3..@-1)::@5$3=sqrt(@2^2 + @3^2 + @4^2) --8<---------------cut here---------------end--------------->8--- Patching org-table.el like this appears to fix the problem: --8<---------------cut here---------------start------------->8--- diff --git a/lisp/org-table.el b/lisp/org-table.el index 339c01c..f17e072 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -2116,7 +2116,8 @@ not overwrite the stored one." ;; Check for old vertical references (setq form (org-rewrite-old-row-references form)) ;; Insert complex ranges - (while (string-match org-table-range-regexp form) + (while (and (string-match org-table-range-regexp form) + (> (length (match-string 0 form)) 1)) (setq form (replace-match (save-match-data --8<---------------cut here---------------end--------------->8--- Here's a ChangeLog entry in case this fix is actually correct: --8<---------------cut here---------------start------------->8--- 2008-10-15 Andreas Seltenreich * org-table.el (org-table-eval-formula): Avoid parsing Calc's HMS forms as ranges. --8<---------------cut here---------------end--------------->8--- regards, andreas -- Org-mode version 6.09a Calc version 2.1 GNU Emacs 22.3.1 (x86_64-unknown-linux-gnu) of 2008-09-15 on tengen