diff --git a/lisp/org-table.el b/lisp/org-table.el index 17424be73..474a44f10 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -2722,7 +2722,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 ff8978dc0..c77ea2d7a 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 | + #+TBLFM: $2=$a+$b+$c +" + (org-table-calc-current-TBLFM) + (buffer-string))))) + (provide 'test-org-table) ;;; test-org-table.el ends here