diff options
author | Kyle Meyer <kyle@kyleam.com> | 2021-02-02 00:26:43 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2021-02-02 00:26:43 -0500 |
commit | 041459727223da8980737ac96637985c78ef3a33 (patch) | |
tree | af534d8f7999458b9d7db974e3acaf4659eb6cbd | |
parent | f85bef28d9a73ec5787e4a8bc8509d95bfd66f41 (diff) | |
parent | 3e64d3475d5bc756521a0cb978103a555b6cc851 (diff) | |
download | org-mode-041459727223da8980737ac96637985c78ef3a33.tar.gz |
Merge branch 'maint'
-rw-r--r-- | lisp/org-capture.el | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 359386d..2de9e11 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -1028,28 +1028,23 @@ Store them in the capture property list." (time-to-days org-overriding-default-time)) ((or (org-capture-get :time-prompt) (equal current-prefix-arg 1)) - ;; Prompt for date. - (let ((prompt-time (org-read-date - nil t nil "Date for tree entry:"))) + ;; Prompt for date. Bind `org-end-time-was-given' so + ;; that `org-read-date-analyze' handles the time range + ;; case and returns `prompt-time' with the start value. + (let* ((org-time-was-given nil) + (org-end-time-was-given nil) + (prompt-time (org-read-date + nil t nil "Date for tree entry:"))) (org-capture-put :default-time - (cond ((and (or (not (boundp 'org-time-was-given)) - (not org-time-was-given)) - (not (= (time-to-days prompt-time) (org-today)))) - ;; Use 00:00 when no time is given for another - ;; date than today? - (apply #'encode-time 0 0 - org-extend-today-until - (cl-cdddr (decode-time prompt-time)))) - ((string-match "\\([^ ]+\\)-[^ ]+[ ]+\\(.*\\)" - 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 - org-read-date-final-answer) - prompt-time (decode-time prompt-time)))) - (t prompt-time))) + (if (or org-time-was-given + (= (time-to-days prompt-time) (org-today))) + prompt-time + ;; Use 00:00 when no time is given for another + ;; date than today? + (apply #'encode-time 0 0 + org-extend-today-until + (cl-cdddr (decode-time prompt-time))))) (time-to-days prompt-time))) (t ;; Current date, possibly corrected for late night |