瀏覽代碼

Merge branch 'maint'

Marco Wahl 5 年之前
父節點
當前提交
31d1bf86a3
共有 2 個文件被更改,包括 12 次插入2 次删除
  1. 2 2
      lisp/org-table.el
  2. 10 0
      testing/lisp/test-org-table.el

+ 2 - 2
lisp/org-table.el

@@ -1368,8 +1368,8 @@ However, when FORCE is non-nil, create new columns if necessary."
     ;; Fix TBLFM formulas, if desirable.
     (when (or (not org-table-fix-formulas-confirm)
 	      (funcall org-table-fix-formulas-confirm "Fix formulas? "))
-      (org-table-fix-formulas "$" nil (1- col) 1)
-      (org-table-fix-formulas "$LR" nil (1- col) 1))))
+      (org-table-fix-formulas "$" nil col 1)
+      (org-table-fix-formulas "$LR" nil col 1))))
 
 (defun org-table-find-dataline ()
   "Find a data line in the current table, which is needed for column commands.

+ 10 - 0
testing/lisp/test-org-table.el

@@ -2394,6 +2394,16 @@ See also `test-org-table/copy-field'."
 	    (org-table-insert-column)
 	    (buffer-string)))))
 
+(ert-deftest test-org-table/insert-column-with-formula ()
+  "Test `org-table-insert-column' with a formula in place."
+  (should
+   (equal "| 1 |   | 1 | 2 |
+#+TBLFM: $4=$1+$3"
+	  (org-test-with-temp-text
+	   "| 1<point> | 1 | 2 |
+#+TBLFM: $3=$1+$2"
+	   (org-table-insert-column)
+	   (buffer-substring-no-properties (point-min) (point-max))))))
 
 
 ;;; Moving single cells