org-table.el: Fix a bug of leaving the inserted TBLFM line
commit67a55acb39a863e5522220a72b467d70fd8bb80f
authorIppei FURUHASHI <top.tuna+orgmode@gmail.com>
Fri, 5 Apr 2013 07:07:00 +0000 (5 16:07 +0900)
committerBastien Guerry <bzg@altern.org>
Sat, 6 Apr 2013 13:15:44 +0000 (6 15:15 +0200)
tree046f346f2d6729b7b7d31ad0ddc86a2d6f4a4d54
parente01daa00becbbe2bde49ec7ab013fd1510a9bbb6
org-table.el: Fix a bug of leaving the inserted TBLFM line

* org-table.el (org-calc-current-TBLFM): Ensure to remove the
currently inserted TBLFM line, when calling `org-table-recalculate'
returns an error and the processing stops.

* testing/lisp/test-org-table.el: Add test.

When you hit =C-c C-c= at the line of "#+TBLFM: $2=$1*2::$2=$1**2" in

    | 1 |   |
    | 2 |   |
    #+TBLFM: $2=$1*1
    #+TBLFM: $2=$1*2::$2=$1**2

you got:

    | 1 |   |
    | 2 |   |
    #+TBLFM: $2=$1*2::$2=$1**2
    #+TBLFM: $2=$1*1
    #+TBLFM: $2=$1*2::$2=$1**2

with the error message of:

    user-error: Double definition `$2=' in TBLFM line, please fix by hand

In this case, you expected:

    | 1 |   |
    | 2 |   |
    #+TBLFM: $2=$1*1
    #+TBLFM: $2=$1*2::$2=$1**2
lisp/org-table.el
testing/lisp/test-org-table.el