emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to mark task as done at specified (past) time?


From: Kyle Meyer
Subject: Re: How to mark task as done at specified (past) time?
Date: Thu, 12 Dec 2019 03:26:55 +0000

Tim Landscheidt <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]