* [PATCH] Avoid parsing Calc's HMS forms as ranges
@ 2008-10-15 10:34 Andreas Seltenreich
2008-10-15 11:12 ` Carsten Dominik
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Seltenreich @ 2008-10-15 10:34 UTC (permalink / raw
To: emacs-orgmode
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 <seltenreich@gmx.de>
* 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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Avoid parsing Calc's HMS forms as ranges
2008-10-15 10:34 [PATCH] Avoid parsing Calc's HMS forms as ranges Andreas Seltenreich
@ 2008-10-15 11:12 ` Carsten Dominik
0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2008-10-15 11:12 UTC (permalink / raw
To: Andreas Seltenreich; +Cc: emacs-orgmode
Applied, thanks.
- Carsten
On Oct 15, 2008, at 12:34 PM, Andreas Seltenreich wrote:
> 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 <seltenreich@gmx.de>
>
> * 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
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-10-15 11:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-15 10:34 [PATCH] Avoid parsing Calc's HMS forms as ranges Andreas Seltenreich
2008-10-15 11:12 ` Carsten Dominik
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.