From cad2044829e6d3ff76c2a3504564ed5bfcc36bfb Mon Sep 17 00:00:00 2001 From: Nicholas Vollmer Date: Sun, 2 Aug 2020 14:42:34 -0400 Subject: [PATCH] org.el: (org-get-cursor-date): Fix regular expression * lisp/org.el (org-get-cursor-date): Fix regular expression. Previous regular expression assumed the time grid string will have two digits in the hour portion of the time string. However, the time grid string does not always have two digits. For example: " 8:00......" --- lisp/org.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index ee8be256d..f8dbb6307 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -18731,22 +18731,22 @@ earliest time on the cursor date that Org treats as that date (let (date day defd tp hod mod) (when with-time (setq tp (get-text-property (point) 'time)) - (when (and tp (string-match "\\([0-9][0-9]\\):\\([0-9][0-9]\\)" tp)) + (when (and tp (string-match "\\([0-2]?[0-9]\\):\\([0-5][0-9]\\)" tp)) (setq hod (string-to-number (match-string 1 tp)) - mod (string-to-number (match-string 2 tp)))) + mod (string-to-number (match-string 2 tp)))) (or tp (let ((now (decode-time))) - (setq hod (nth 2 now) - mod (nth 1 now))))) + (setq hod (nth 2 now) + mod (nth 1 now))))) (cond ((eq major-mode 'calendar-mode) (setq date (calendar-cursor-to-date) - defd (encode-time 0 (or mod 0) (or hod org-extend-today-until) - (nth 1 date) (nth 0 date) (nth 2 date)))) + defd (encode-time 0 (or mod 0) (or hod org-extend-today-until) + (nth 1 date) (nth 0 date) (nth 2 date)))) ((eq major-mode 'org-agenda-mode) (setq day (get-text-property (point) 'day)) (when day (setq date (calendar-gregorian-from-absolute day) - defd (encode-time 0 (or mod 0) (or hod org-extend-today-until) + defd (encode-time 0 (or mod 0) (or hod org-extend-today-until) (nth 1 date) (nth 0 date) (nth 2 date)))))) (or defd (current-time)))) -- 2.28.0