From de58e0ae3351f4333752da07ad13db549b2a44bc Mon Sep 17 00:00:00 2001 From: Marco Wahl Date: Sat, 4 Feb 2017 00:19:49 +0100 Subject: [PATCH] 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'. --- lisp/org.el | 2 +- testing/lisp/test-org.el | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index e7d6b571b..619df32bb 100644 --- a/lisp/org.el +++ b/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) diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 58aefa55f..0f6bb99fe 100644 --- a/testing/lisp/test-org.el +++ b/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