[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] capture: Fix handling of time range for :time-prompt
From: |
Richard Lawrence |
Subject: |
Re: [PATCH] capture: Fix handling of time range for :time-prompt |
Date: |
Tue, 02 Feb 2021 17:59:36 +0100 |
Kyle Meyer <kyle@kyleam.com> writes:
> Pushed (3e64d3475).
Thank you!
>> As far as I can tell, that is not fully possible today, even with this
>> patch. The reason is that time *range* information entered at the prompt
>> generated by :time-prompt gets thrown away. The reason for *that* is
>> that org-read-date is called with t as its to-time argument (the second
>> argument), so that the date is returned in Emacs' internal time
>> representation, which doesn't represent ranges.
>
> Hmm. Is it really about the TO-TIME argument? If org-read-date is
> called with TO-TIME as nil, doesn't it still throw away the end of the
> range?
>
> (let ((org-time-was-given nil)
> (org-end-time-was-given nil))
> (org-read-date nil nil nil "Date for tree entry:"))
> ;; enter "3pm-4pm" => "2021-02-01 15:00"
>
> Or, actually, it stores the end in org-end-time-was-given, but it does
> that regardless of the TO-TIME argument.
Ah, that's interesting, thanks for pointing it out. I thought I had
checked to see if org-end-time-was-given had a value after org-read-date
gets called for a capture :time-prompt, but now I see that of course
that wouldn't work without the surrounding let binding...
OK, so with your patch, the way is clear to stick this value in
org-capture-plist and make use of it when filling %T and friends in
templates. I'll see if I can come up with a patch to do that, and
report back.
--
Best,
Richard