diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2015-12-04 21:34:40 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2015-12-04 21:34:40 +0100 |
commit | 06c6ba4ac3750032dbbde67fc75c41940f3040c8 (patch) | |
tree | bf9057facc1877368b600b94e437bc8e0c5be78a | |
parent | 54c584738564661a916e3c1a223c8ddab7e29f48 (diff) | |
download | org-mode-06c6ba4ac3750032dbbde67fc75c41940f3040c8.tar.gz |
org-table: Fix named fields with TAB-indentation
* lisp/org-table.el (org-table-eval-formula): Properly parse named
fields when indentation of current line ends with a TAB character.
* testing/lisp/test-org-table.el (test-org-table/tab-indent): New test.
Reported-by: Piotr Gajewski <pg7@outlook.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/103290>
-rw-r--r-- | lisp/org-table.el | 4 | ||||
-rw-r--r-- | testing/lisp/test-org-table.el | 15 |
2 files changed, 18 insertions, 1 deletions
diff --git a/lisp/org-table.el b/lisp/org-table.el index 09f4473..c3593df 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -2729,7 +2729,9 @@ not overwrite the stored one." (setq orig (or (get-text-property 1 :orig-formula formula) "?")) (while (> ndown 0) (setq fields (org-split-string - (buffer-substring-no-properties (point-at-bol) (point-at-eol)) + (org-trim + (buffer-substring-no-properties + (line-beginning-position) (line-end-position))) " *| *")) ;; replace fields with duration values if relevant (if duration diff --git a/testing/lisp/test-org-table.el b/testing/lisp/test-org-table.el index ff8978d..c77ea2d 100644 --- a/testing/lisp/test-org-table.el +++ b/testing/lisp/test-org-table.el @@ -1820,6 +1820,21 @@ is t, then new columns should be added as needed" (org-table-calc-current-TBLFM) (buffer-string))))) +(ert-deftest test-org-table/tab-indent () + "Test named fields with tab indentation." + (should + (org-string-match-p + "| # | 111 |" + (org-test-with-temp-text + " + | ! | sum | | a | b | c | + |---+------+------+---+----+-----| + | # | 1011 | 1000 | 1 | 10 | 100 | + <point>#+TBLFM: $2=$a+$b+$c +" + (org-table-calc-current-TBLFM) + (buffer-string))))) + (provide 'test-org-table) ;;; test-org-table.el ends here |