소스 검색

Merge branch 'maint'

Nicolas Goaziou 8 년 전
부모
커밋
a9aad1c8e1
2개의 변경된 파일29개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      lisp/org-table.el
  2. 27 0
      testing/lisp/test-org-table.el

+ 2 - 2
lisp/org-table.el

@@ -3194,8 +3194,8 @@ existing formula for column %s"
 		      (re-search-forward org-table-hline-regexp end t)
 		      (re-search-forward org-table-dataline-regexp end t))
 		 (setq beg (match-beginning 0)))
-		;; Just leave BEG where it is.
-		(t (setq beg (line-beginning-position)))))
+		;; Just leave BEG at the start of the table.
+		(t nil)))
 	   (setq beg (line-beginning-position)
 		 end (copy-marker (line-beginning-position 2))))
 	 (goto-char beg)

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

@@ -2009,6 +2009,33 @@ is t, then new columns should be added as needed"
 |  4 | too large |
 #+TBLFM: $2 = '(orgtbl-ascii-draw $1 0 3 3 \"$-\")")))
 
+(ert-deftest test-org-table/single-rowgroup ()
+  "Test column formula in a table with a single rowgroup."
+  (should
+   (equal
+    "
+|---+---|
+| 1 | 0 |
+|---+---|
+#+TBLFM: $2=$1-1"
+    (org-test-with-temp-text "
+|---+---|
+| 1 |   |
+|---+---|
+<point>#+TBLFM: $2=$1-1"
+      (org-table-calc-current-TBLFM)
+      (buffer-string))))
+  (should
+   (equal
+    "
+| 1 | 0 |
+#+TBLFM: $2=$1-1"
+    (org-test-with-temp-text "
+| 1 |   |
+<point>#+TBLFM: $2=$1-1"
+      (org-table-calc-current-TBLFM)
+      (buffer-string)))))
+
 
 (provide 'test-org-table)