mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-20 17:48:35 +00:00
org-capture.el: Set a correct time value with file+datetree+prompt
* org-capture.el (org-capture-set-target-location): Set a correct time value when storing a note in a datetree and prompting the user for a date. Thanks to Gregor Zattler for reporting this.
This commit is contained in:
parent
ec9f52d185
commit
b61ff117bc
|
@ -880,11 +880,22 @@ already gone. Any prefix argument will be passed to the refile command."
|
||||||
(let ((prompt-time (org-read-date
|
(let ((prompt-time (org-read-date
|
||||||
nil t nil "Date for tree entry:"
|
nil t nil "Date for tree entry:"
|
||||||
(current-time))))
|
(current-time))))
|
||||||
(org-capture-put :prompt-time prompt-time
|
(org-capture-put
|
||||||
:default-time prompt-time)
|
:default-time
|
||||||
|
(cond ((and (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 (append '(0 0 0) (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)))
|
||||||
(time-to-days prompt-time)))
|
(time-to-days prompt-time)))
|
||||||
(t
|
(t
|
||||||
;; current date, possible corrected for late night workers
|
;; current date, possibly corrected for late night workers
|
||||||
(org-today))))))
|
(org-today))))))
|
||||||
|
|
||||||
((eq (car target) 'file+function)
|
((eq (car target) 'file+function)
|
||||||
|
|
Loading…
Reference in a new issue