From: Ihor Radchenko <yantar92@gmail.com>
To: Robert Nikander <robert.nikander@icloud.com>
Cc: emacs-orgmode@gnu.org
Subject: [PATCH] Re: [BUG] Manual says +2h works for date entry, but it doesn't
Date: Sat, 18 Dec 2021 17:44:38 +0800 [thread overview]
Message-ID: <871r2ackmx.fsf@localhost> (raw)
In-Reply-To: <C9A76EFA-1D76-4C5D-941D-AFA288A64CD0@icloud.com>
[-- Attachment #1: Type: text/plain, Size: 440 bytes --]
Robert Nikander <robert.nikander@icloud.com> writes:
> The manual here: https://orgmode.org/manual/The-date_002ftime-prompt.html
>
> says that you can use syntax like `+2h` when entering timestamps. It doesn’t
> seem to work, but `+2d` does. Is the manual simply out of sync with the
> implementation?
I can confirm that +2h syntax is not supported.
The attached patch makes hours work in the time prompt.
Best,
Ihor
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Date-time-prompt-Allow-input-of-relative-time-in-hou.patch --]
[-- Type: text/x-diff, Size: 1697 bytes --]
From 21e0680c1443bc3dc3b025f5782276edcf3a7ada Mon Sep 17 00:00:00 2001
Message-Id: <21e0680c1443bc3dc3b025f5782276edcf3a7ada.1639820517.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Sat, 18 Dec 2021 16:33:57 +0800
Subject: [PATCH] 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
---
lisp/org.el | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index ce4e08eab..393f45f26 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14536,10 +14536,14 @@ (defun org-read-date-analyze (ans def defdecode)
(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.
--
2.32.0
next prev parent reply other threads:[~2021-12-18 9:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-06 2:02 [BUG] Manual says +2h works for date entry, but it doesn't Robert Nikander
2021-12-18 9:44 ` Ihor Radchenko [this message]
2022-06-09 13:38 ` [PATCH] " Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871r2ackmx.fsf@localhost \
--to=yantar92@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=robert.nikander@icloud.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).