Browse Source

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 years ago
parent
commit
de58e0ae33
2 changed files with 6 additions and 1 deletions
  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