From 67b5006258eb44863de86faeaab3baf2417e64f9 Mon Sep 17 00:00:00 2001 From: "Chance.Yang" Date: Mon, 10 May 2021 11:38:57 +0800 Subject: [PATCH] fix dotime parsing made org-get-timerange parse the actualy timerange rather than doing relative calculations dotime appears to have contained something else in the past https://github.com/zemaye/emacs-calfw/commit/3d17649c545423d919fd3bb9de2efe6dfff210fe https://github.com/kiwanami/emacs-calfw/issues/124#issuecomment-627079563 --- calfw-org.el | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/calfw-org.el b/calfw-org.el index 5e0c039..a50153d 100644 --- a/calfw-org.el +++ b/calfw-org.el @@ -231,19 +231,18 @@ If this function splits into a list of string, the calfw displays those string i If TEXT does not have a range, return nil." (let* ((dotime (cfw:org-tp text 'dotime))) (and (stringp dotime) (string-match org-ts-regexp dotime) - (let ((date-string (match-string 1 dotime)) + (let* ((matches (s-match-strings-all org-ts-regexp dotime)) + (start-date (nth 1 (car matches))) + (end-date (nth 1 (nth 1 matches))) (extra (cfw:org-tp text 'extra))) (if (string-match "(\\([0-9]+\\)/\\([0-9]+\\)): " extra) - (let* ((cur-day (string-to-number - (match-string 1 extra))) - (total-days (string-to-number - (match-string 2 extra))) - (start-date (org-read-date nil t date-string)) - (end-date (time-add - (org-read-date nil t date-string) - (seconds-to-time (* 3600 24 (- total-days 1)))))) - (list (calendar-gregorian-from-absolute (time-to-days start-date)) - (calendar-gregorian-from-absolute (time-to-days end-date)) text)) + ( list( calendar-gregorian-from-absolute + (time-to-days + (org-read-date nil t start-date)) + ) + (calendar-gregorian-from-absolute + (time-to-days + (org-read-date nil t end-date))) text) ))))) (defun cfw:org-schedule-period-to-calendar (begin end)