emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] Date prompt suggests yesterday when changing timestamp with or


From: Ihor Radchenko
Subject: Re: [BUG] Date prompt suggests yesterday when changing timestamp with org-extend-today-until set [9.6]
Date: Sun, 22 Jan 2023 11:44:53 +0000

Tim Ruffing <crypto@timruffing.de> writes:

> Assume org-extend-today-until is set to an integer greater 0, say 3.
> When I change a timestamp without date such as <2023-01-20> (e.g, when
> rescheduling), the prompt defaults to a day earlier, i.e., to "2023-01-
> 19" in this case. The same happens with <2023-01-20 01:00> which is
> still before 3am. 

Thanks for reporting!
May you try the attached patch?

I am, however, still concerned about how `org-read-date' is handling
`org-extend-today-until'.

If we have something like

* This is test
SCHEDULED: <2023-01-28 Sat>

Then, M-: (setq org-extend-today-until 20)
Then, C-c C-s on the heading above

What will happen if one tries to do "." or +1 or ++1. I find the current
behavior rather disorienting. Could someone check what we promise in the
Org manual, `org-read-date' docstring, `org-extend-today-until'
docstring, and what actually happens in practice?

>From 998f2f9b93f5727942fa0e53567288ebcf544764 Mon Sep 17 00:00:00 2001
Message-Id: 
<998f2f9b93f5727942fa0e53567288ebcf544764.1674387603.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Sun, 22 Jan 2023 14:37:47 +0300
Subject: [PATCH] org-read-date: Do not consider `org-extend-today-until' with
 default time

* lisp/org.el (org-read-date): When DEFAULT-TIME time provided, prefer
it even when `org-extend-today-until' dictates -1 day shift.  We
should only consider `org-extend-today-until' for actual today times,
not for future dates, where is becomes confusing.

Reported-by: Tim Ruffing <crypto@timruffing.de>
Link: 
3489c1917ad4be0625ea5f0b2c1b0f2b72ea39e9.camel@timruffing.de">https://orgmode.org/list/3489c1917ad4be0625ea5f0b2c1b0f2b72ea39e9.camel@timruffing.de
---
 lisp/org.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 0e6a3da0a..f4cc7b4be 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -13695,7 +13695,11 @@ (defun org-read-date (&optional with-time to-time 
from-string prompt
         (calendar-view-holidays-initially-flag nil)
         ans (org-ans0 "") org-ans1 org-ans2 final cal-frame)
     ;; Rationalize `org-def' and `org-defdecode', if required.
-    (when (< (nth 2 org-defdecode) org-extend-today-until)
+    ;; Only consider `org-extend-today-until' when explicit reference
+    ;; time is not given.
+    (when (and (not default-time)
+               (not org-overriding-default-time)
+               (< (nth 2 org-defdecode) org-extend-today-until))
       (setf (nth 2 org-defdecode) -1)
       (setf (nth 1 org-defdecode) 59)
       (setq org-def (org-encode-time org-defdecode))
-- 
2.39.1

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]