emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Tim Ruffing <crypto@timruffing.de>
Cc: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <87zgaan68a.fsf@localhost> (raw)
In-Reply-To: <3489c1917ad4be0625ea5f0b2c1b0f2b72ea39e9.camel@timruffing.de>

[-- Attachment #1: Type: text/plain, Size: 944 bytes --]

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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-read-date-Do-not-consider-org-extend-today-until.patch --]
[-- Type: text/x-patch, Size: 1632 bytes --]

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: 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


[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
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	other threads:[~2023-01-22 11:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-20 11:55 [BUG] Date prompt suggests yesterday when changing timestamp with org-extend-today-until set [9.6] Tim Ruffing
2023-01-22 11:44 ` Ihor Radchenko [this message]
2023-03-09 23:26   ` Tim Ruffing
2023-03-11  9:33     ` 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=87zgaan68a.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=crypto@timruffing.de \
    --cc=emacs-orgmode@gnu.org \
    /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).