From: Adam Spiers <orgmode@adamspiers.org>
To: Kyle Meyer <kyle@kyleam.com>
Cc: org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: time-warping - retroactively marking DONE?
Date: Sun, 25 Jun 2023 17:03:39 +0100 [thread overview]
Message-ID: <CAOkDyE-DwkH4_kW1q5bzHAiG1-EyxnJnt4nw_DhhYHUi12unvw@mail.gmail.com> (raw)
In-Reply-To: <87k0ze621e.fsf@kyleam.com>
Three years later, I finally tried this:
On Wed, 8 Jul 2020 at 05:53, Kyle Meyer <kyle@kyleam.com> wrote:
> Adam Spiers writes:
> > I'm looking for a way to retroactively mark a task as having been done
> > at a previous time/date. I know that I can just change the keyword to
> > DONE and then edit the timestamp, but this is tedious when it's a
> > repeating event, e.g.:
> [...]
>
> I'm not aware of any built-in support for this.
>
> > If this is not currently possible, would it make sense to write a
> > wrapper around `org-todo', e.g. `org-todo-timewarp' or
> > `org-retroactive-todo', which interactively prompts for a timestamp
> > before invoking `org-todo'?
>
> I think this is the easiest approach, though I'm not sure such a wrapper
> needs to live in Org proper. Here's a snippet from a recent thread [*]
> that should get you most of the way there:
>
> (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)))
>
>
> [*] https://orgmode.org/list/875zj42rpx.fsf@passepartout.tim-landscheidt.de/T/#u
I made it read a time interactively:
(defun as-org-todo-time-machine (arg)
(interactive "P")
(let ((fake-time
(apply #'encode-time (org-parse-time-string
(org-read-date)
))))
(cl-letf (((symbol-function 'current-time)
(lambda () fake-time)))
(call-interactively #'org-todo))))
It almost works perfectly, although monkey-patching current-time doesn't affect
the code in org-auto-repeat-maybe which sets LAST_REPEAT, since that uses
the built-in format-time-string:
(org-entry-put nil "LAST_REPEAT" (format-time-string
(org-time-stamp-format t t))))
I found that adding (current-time) as the optional time parameter fixed it:
(org-entry-put nil "LAST_REPEAT" (format-time-string
(org-time-stamp-format t t)
(current-time))))
since that allows the monkey-patching to apply there too. Is it worth
submitting
a patch for this?
next prev parent reply other threads:[~2023-06-25 16:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-07 11:26 time-warping - retroactively marking DONE? Adam Spiers
2020-07-08 4:53 ` Kyle Meyer
2023-06-25 16:03 ` Adam Spiers [this message]
2023-06-25 16:13 ` Adam Spiers
2023-06-25 19:47 ` Marcin Borkowski
2020-07-08 5:52 ` Marcin Borkowski
[not found] <mailman.55.1594224009.21222.emacs-orgmode@gnu.org>
2020-07-08 21:38 ` No Wayman
2020-08-30 0:22 ` Adam Spiers
2020-08-30 1:32 ` No Wayman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAOkDyE-DwkH4_kW1q5bzHAiG1-EyxnJnt4nw_DhhYHUi12unvw@mail.gmail.com \
--to=orgmode@adamspiers.org \
--cc=emacs-orgmode@gnu.org \
--cc=kyle@kyleam.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.