Tim Landscheidt <t...@tim-landscheidt.de> writes:
[...]
> I want Gnus to mark the task as done /at the time when the mail was
> sent/, i. e. in:
> |    - State "DONE"       from "TODO"       [2019-11-27 Mi 16:44]
>
> I want "2019-11-27 Mi 16:44" not to be the current time, but
> some other (past) time.
>
> How can I mark a task as done at a specified time?  Looking
> at org-add-planning-info, there seems to be a mechanism to
> pass a timestamp, but it does not seem to be exposed at
> higher levels (?).

Yes, as far as I can see, org-todo uses the TIME argument of
org-add-planning-info for the org-extend-today-until feature, but
there's not a way for the caller to directly specify the timestamp.

> Do I have to cl-flet org-current-time or something similar?

Something along those lines would probably be the most straightforward.
Light testing with the command below suggests overriding current-time is
sufficient:

    (defun my-org-todo-time-machine ()
      (interactive)
      (cl-letf (((symbol-function 'current-time)
                 (lambda ()
                   (apply #'encode-time (org-parse-time-string
                                         "2019-11-27 Mi 16:44")))))
        (call-interactively #'org-todo)))

Reply via email to