diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2010-04-24 10:22:49 +0200 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2010-04-24 14:39:28 +0200 |
commit | 44622297420c16676b11dfa8b306098ded0081e7 (patch) | |
tree | 0f282d7f4f8dc10d1bbe562a948c7cb427a7ef1d | |
parent | 3a7f7dbccaa306dbb170ecbea50e238cc757a69c (diff) | |
download | org-mode-44622297420c16676b11dfa8b306098ded0081e7.tar.gz |
Fix table formula bug with negative result numbers
Willian Henney writes:
> The following is using today's git trunk of org-mode with emacs
> 23.1.94.1 (aquamacs 2.0preview5)
>
> Consider the following table
>
> | -8 |
> | |
> | |
> | |
> #+TBLFM: $1=@-1 - 1::@1$1=-8
>
> Evaluate formulas once (C-u C-c *):
>
> | -8 |
> | -9 |
> |----|
> | -1 |
>
> Evaluate formulas again (C-u C-c *):
>
> | -8 |
> | -9 |
> |----|
> |----|
>
> What I expected:
>
> | -8 |
> | -9 |
> | -10 |
> | -11 |
>
> The problem always seems to start at -10. When I turn on table
> debugging, it first calculates the -10 value correctly, but then fails
> to recognise the -10 cell as a number when calculating the next row,
> using 0 instead, which results in -1. This is because during the
> intermediate formatting of the cell the minus sign in -10 abuts the
> column separator: "|-10 |", and the "|-" part is then interpreted as
> the beginning of an hline.
-rwxr-xr-x | lisp/ChangeLog | 5 | ||||
-rw-r--r-- | lisp/org-table.el | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fa5703a..f4800f0 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-04-24 Carsten Dominik <carsten.dominik@gmail.com> + + * org-table.el (org-table-justify-field-maybe): Make sure that + inserting a value does not turn a line into a hline. + 2010-04-23 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-sum): New argument HEADLINE-FILTER. diff --git a/lisp/org-table.el b/lisp/org-table.el index c2df706..4309759 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -830,6 +830,7 @@ Optional argument NEW may specify text to replace the current field content." (if (<= (length new) l) ;; FIXME: length -> str-width? (setq n (format f new)) (setq n (concat new "|") org-table-may-need-update t))) + (if (equal (string-to-char n) ?-) (setq n (concat " " n))) (or (equal n o) (let (org-table-may-need-update) (replace-match n t t)))) |