瀏覽代碼

Fix org-get-repeat

* lisp/org.el (org-get-repeat): Wrap call to save match data against
  side effects.

* testing/lisp/test-org.el (test-org/get-repeat): New test for
  `org-get-repeat'.
Marco Wahl 8 年之前
父節點
當前提交
de58e0ae33
共有 2 個文件被更改,包括 6 次插入1 次删除
  1. 1 1
      lisp/org.el
  2. 5 0
      testing/lisp/test-org.el

+ 1 - 1
lisp/org.el

@@ -13204,7 +13204,7 @@ on INACTIVE-OK."
 		      org-repeat-re)))
 	(catch :repeat
 	  (while (re-search-forward regexp end t)
-	    (when (org-at-timestamp-p)
+	    (when (save-match-data (org-at-timestamp-p))
 	      (throw :repeat (match-string-no-properties 1)))))))))
 
 (defvar org-last-changed-timestamp)

+ 5 - 0
testing/lisp/test-org.el

@@ -400,6 +400,11 @@
       (org-test-with-temp-text "* DONE Heading"
 	(should-not (org-deadline-close-p "2016-06-03"))))))
 
+(ert-deftest test-org/get-repeat ()
+  (org-test-with-temp-text
+   "* H\nSCHEDULED: <2017-02-03 Fri .+23d>"
+   (should (string= ".+23d" (org-get-repeat)))))
+
 
 ;;; Drawers