diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-09-14 15:33:51 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-09-14 15:40:28 +0200 |
commit | 25f12218d2fe1152cba840d1a0caedddb1656d90 (patch) | |
tree | f230831a5e447599c0e6a67dac0d8f506f0e73cd | |
parent | 63f1ffac3244d22925a360adb757a2fcea6c38c4 (diff) | |
download | org-mode-25f12218d2fe1152cba840d1a0caedddb1656d90.tar.gz |
Fix `org-auto-repeat-maybe'
* lisp/org.el (org-auto-repeat-maybe): Fix `org-auto-repeat-maybe'.
* testing/lisp/test-org.el (test-org/auto-repeat-maybe): Add test.
Reported-by: Samuel Wales <samologist@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-09/msg00298.html>
-rw-r--r-- | lisp/org.el | 5 | ||||
-rw-r--r-- | testing/lisp/test-org.el | 15 |
2 files changed, 17 insertions, 3 deletions
diff --git a/lisp/org.el b/lisp/org.el index 576e073..5ebfa82 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -13053,8 +13053,9 @@ This function is run automatically after each state change to a DONE state." ;; a clock, set LAST_REPEAT property. (when (or org-log-repeat (catch :clock - (while (re-search-forward org-clock-line-re end t) - (when (org-at-clock-log-p) (throw :clock t))))) + (save-excursion + (while (re-search-forward org-clock-line-re end t) + (when (org-at-clock-log-p) (throw :clock t)))))) (org-entry-put nil "LAST_REPEAT" (format-time-string (org-time-stamp-format t t) (current-time)))) diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 28e2d7f..c4a2a58 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -6047,7 +6047,7 @@ Paragraph<point>" (cl-letf (((symbol-function 'org-add-log-setup) (lambda (&rest args) nil))) (org-test-with-temp-text - "* TODO H\n<2012-03-29 Thu. +2y>\nCLOCK: [2012-03-29 Thu 16:40]" + "* TODO H\n<2012-03-29 Thu +2y>\nCLOCK: [2012-03-29 Thu 16:40]" (org-todo "DONE") (buffer-string)))))) ;; When a SCHEDULED entry has no repeater, remove it upon repeating @@ -6059,6 +6059,19 @@ Paragraph<point>" (org-test-with-temp-text "* TODO H\nSCHEDULED: <2014-03-04 Tue>\n<2012-03-29 Thu +2y>" (org-todo "DONE") + (buffer-string))))) + ;; Properly advance repeater even when a clock entry is specified + ;; and `org-log-repeat' is nil. + (should + (string-match-p + "SCHEDULED: <2014-03-29" + (let ((org-log-repeat nil) + (org-todo-keywords '((sequence "TODO" "DONE")))) + (org-test-with-temp-text + "* TODO H +SCHEDULED: <2012-03-29 Thu +2y> +CLOCK: [2012-03-29 Thu 10:00]--[2012-03-29 Thu 16:40] => 6:40" + (org-todo "DONE") (buffer-string)))))) |