Earl Chase <[email protected]> writes:

>> We also need other similar commands. For example, org-agenda-todo-at.
>>
>
> I added `org-agenda-todo-at' as a separate patch. Both
> `org-agenda-todo-at' and `org-todo-at' only use the interactive
> version of `org-read-date' when they are called interactively.

The way it is implemented feels like too much copy-pasting.
Maybe we can extend org-todo itself to accept optional argument TIME
that can be nil (current time), 'query - query interactively, or a
string - time to be used. Then, the code will be less repetitive I think.

Also, I noticed that time is forced to be present even when I do not
enter it, and defaults to current time. It does not feel right. Maybe we
need to put 00:00 or something.

> But
> the specific problem that I was referring to is more complicated than
> that. In addition to the `org-todo-at' patch and the
> `org-agenda-todo-at', I created another patch with a simple test that
> shows why this approach makes it impossible to test `org-todo-at' with
> repeaters, for the moment at least. You will see that when you call
> `org-todo-at', LAST_REPEAT gets set to the correct value but the
> repeater itself is not set to the right value. I still haven't found
> the root cause of this issue. But I do know that LAST_REPEAT is always
> set to the correct time because `org-auto-repeat-maybe' directly uses
> `org-current-effective-time' to create the new value of LAST_REPEAT.
> On the other hand, `org-today' and `org-timestamp-to-now' are the
> functions that `org-auto-repeat-maybe' uses to actually update a
> repeater. Those functions of course can be overridden. But I think a
> better idea would be to create org versions of `time-to-days',
> `time-since' and `float-time', as those are the functions that
> `org-timestamp-to-now' and `org-today' uses internally. I still don't
> understand why none of that is needed for manual tests.

Yes, that would make sense.
(And yes, this is why this patch is less trivial that one may think;
especially if we want to support effective time across Org)

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
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