From a6c223664aad6096943e236c9a51c30246e57669 Mon Sep 17 00:00:00 2001 From: Richard Lawrence Date: Wed, 6 Jan 2021 11:53:42 +0100 Subject: [PATCH] org-capture: fix expansion of %T when capturing to a datetree * org-capture.el (org-capture-set-target-location): Use a narrower regular expression to replace a time range by its start time when setting :default-time, so that dates do not get mangled. TINYCHANGE --- lisp/org-capture.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org-capture.el b/lisp/org-capture.el index f40f2b335..df0eccdbb 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -1038,12 +1038,12 @@ Store them in the capture property list." (apply #'encode-time 0 0 org-extend-today-until (cl-cdddr (decode-time prompt-time)))) - ((string-match "\\([^ ]+\\)-[^ ]+[ ]+\\(.*\\)" + ((string-match "\\(--?\\([012]?[0-9]\\)\\(\\(:[0-5][0-9]\\)\\|\\(am\\|AM\\|pm\\|PM\\)\\>\\)\\)\\(.*\\)" org-read-date-final-answer) ;; Replace any time range by its start. (apply #'encode-time (org-read-date-analyze - (replace-match "\\1 \\2" nil nil + (replace-match "\\6" nil nil org-read-date-final-answer) prompt-time (decode-time prompt-time)))) (t prompt-time))) -- 2.20.1