0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 18:36:26 +00:00

Date/time prompt: Allow input of relative time in hours (e.g. +1h)

* lisp/org.el (org-read-date-analyze): Match relative hour specifier.

Fixes https://orgmode.org/list/C9A76EFA-1D76-4C5D-941D-AFA288A64CD0@icloud.com
This commit is contained in:
Ihor Radchenko 2021-12-18 16:33:57 +08:00
parent d9963c58dc
commit 57d64cf78c
No known key found for this signature in database
GPG key ID: 6470762A7DA11D8B

View file

@ -13684,10 +13684,14 @@ user."
(unless deltadef
(let ((now (decode-time)))
(setq day (nth 3 now) month (nth 4 now) year (nth 5 now))))
(cond ((member deltaw '("d" "")) (setq day (+ day deltan)))
((equal deltaw "w") (setq day (+ day (* 7 deltan))))
((equal deltaw "m") (setq month (+ month deltan)))
((equal deltaw "y") (setq year (+ year deltan)))))
(cond ((member deltaw '("h" ""))
(when (boundp 'org-time-was-given)
(setq org-time-was-given t))
(setq hour (+ hour deltan)))
((member deltaw '("d" "")) (setq day (+ day deltan)))
((equal deltaw "w") (setq day (+ day (* 7 deltan))))
((equal deltaw "m") (setq month (+ month deltan)))
((equal deltaw "y") (setq year (+ year deltan)))))
((and wday (not (nth 3 tl)))
;; Weekday was given, but no day, so pick that day in the week
;; on or after the derived date.