On Fri, 7 Jun 2019 at 22:31, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote:

> Hello,
>
> Neil Jerram <neiljer...@gmail.com> writes:
>
> > Nicolas, I hope you don't mind me sending a 'ping' for this, as it looks
> > like it might have got lost.  Please do let me know what you think.
>
> I'm not sure this is a right fix. Doesn't it force default times to noon
> instead of midnight? I think default times should be midnight.
>

Yes, it does make the default time noon.  But AFAICS the time of day
doesn't actually matter in any of the Org source code where the result of
org-get-cursor-date is used.  Have I missed a case where it does matter?

However, in the attached patch I've revised that so that the default time
of day is <org-extend-today-until>:00am, i.e. it's the earliest time that
Org treats as being that date.  WDYT?

Alternatively, we could refactor the code around where org-get-cursor-date
is used to make it more explicit when the time of day doesn't matter, and
look further if there are any cases where it does.

Best wishes,
    Neil
From 48b342bbd8c97bf24214b57e04d6d59108320ba0 Mon Sep 17 00:00:00 2001
From: Neil Jerram <n...@tigera.io>
Date: Tue, 28 May 2019 21:01:17 +0100
Subject: [PATCH] Make capture's idea of the current day more intuitive

---
 lisp/org.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index c6861dc9a..6af97b348 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -18936,7 +18936,9 @@ Returns the number of empty lines passed."
 This works in the calendar and in the agenda, anywhere else it just
 returns the current time.
 If WITH-TIME is non-nil, returns the time of the event at point (in
-the agenda) or the current time of the day."
+the agenda) or the current time of the day; otherwise returns the
+earliest time on the cursor date that Org treats as that date
+(bearing in mind `org-extend-today-until')."
   (let (date day defd tp hod mod)
     (when with-time
       (setq tp (get-text-property (point) 'time))
@@ -18949,13 +18951,13 @@ the agenda) or the current time of the day."
     (cond
      ((eq major-mode 'calendar-mode)
       (setq date (calendar-cursor-to-date)
-	    defd (encode-time 0 (or mod 0) (or hod 0)
+	    defd (encode-time 0 (or mod 0) (or hod org-extend-today-until)
 			      (nth 1 date) (nth 0 date) (nth 2 date))))
      ((eq major-mode 'org-agenda-mode)
       (setq day (get-text-property (point) 'day))
       (when day
 	(setq date (calendar-gregorian-from-absolute day)
-	      defd (encode-time 0 (or mod 0) (or hod 0)
+	      defd (encode-time 0 (or mod 0) (or hod org-extend-today-until)
 				(nth 1 date) (nth 0 date) (nth 2 date))))))
     (or defd (current-time))))
 
-- 
2.17.1

Reply via email to