Re: time-warping - retroactively marking DONE?

2023-06-25 Thread Marcin Borkowski


On 2023-06-25, at 18:03, Adam Spiers  wrote:

> Three years later, I finally tried this:
>
> On Wed, 8 Jul 2020 at 05:53, Kyle Meyer  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.

Not built-in, and yet another solution, but see also here:
https://mbork.pl/2019-08-05_datefudge_and_agenda_testing

And, of course, `org-todo-yesterday'.

Best,

-- 
Marcin Borkowski
http://mbork.pl



Re: time-warping - retroactively marking DONE?

2023-06-25 Thread Adam Spiers
On Sun, 25 Jun 2023 at 17:03, Adam Spiers  wrote:
> Three years later, I finally tried this:

Apologies for the noise; apparently three years is enough time for me
to completely forget that I'd already found a better solution to this:

https://list.orgmode.org/caokdye-dwkh4_kw1q5bzhaig1-eyxnjnt4nw_dhhyhui12u...@mail.gmail.com/T/#me7c7a5f2d750217c47ec27c1a4ed712a62991a9d



Re: time-warping - retroactively marking DONE?

2023-06-25 Thread Adam Spiers
Three years later, I finally tried this:

On Wed, 8 Jul 2020 at 05:53, Kyle Meyer  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@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?



Re: time-warping - retroactively marking DONE?

2020-08-29 Thread No Wayman



Adam Spiers  writes:


Many thanks again for this.  It's working great for me!

In case anyone's interested, here's my use-package config (which 
uses

the awesome straight.el package manager to install it):

https://github.com/aspiers/emacs/blob/aa62bd84b51a02cb0fc980862a63514349d253bf/.emacs.d/init.d/as-org-mode.el#L111-L116

I agree with your observation that it might be nicer to separate 
out
the org-specific stuff into a separate package, because the 
epoch

stuff seems useful in its own right outside org-mode.


Thanks for trying it out. There are still some rough edges I have 
to work out, but I plan on working on it more when I get some more 
free time.




Re: time-warping - retroactively marking DONE?

2020-08-29 Thread Adam Spiers
On Wed, 8 Jul 2020 at 23:09, No Wayman  wrote:
> I emailed Adam directly with an experimental package I wrote to
> solve the problem of changing the todo-state of an entry at an
> arbitrary time.
> He suggested I posted here as well:
>
> https://github.com/progfolio/epoch/
>
> The package advises current-time to return `epoch-current-time' if
> is set (falling back to the usual current-time if not).
> A macro, `epoch-with-time' is provided which allows a body to be
> executed with current-time set to an arbitrary time.
> Two commands (which I may separate into their own package),
> `epoch-todo' and `epoch-agenda-todo' call their respective
> org-mode commands.
> `org-read-date' is called with the tasks's SCHEDULED or DEADLINE
> time pre-populated so one can easily edit relative to that time.
>
> Still very much a work in progress, but the two commands are
> useful for me so far.
>
> Any ideas, suggestions, criticisms are appreciated.

Many thanks again for this.  It's working great for me!

In case anyone's interested, here's my use-package config (which uses
the awesome straight.el package manager to install it):

https://github.com/aspiers/emacs/blob/aa62bd84b51a02cb0fc980862a63514349d253bf/.emacs.d/init.d/as-org-mode.el#L111-L116

I agree with your observation that it might be nicer to separate out
the org-specific stuff into a separate package, because the epoch
stuff seems useful in its own right outside org-mode.



Re: time-warping - retroactively marking DONE?

2020-07-08 Thread No Wayman



I emailed Adam directly with an experimental package I wrote to 
solve the problem of changing the todo-state of an entry at an 
arbitrary time.

He suggested I posted here as well:

https://github.com/progfolio/epoch/

The package advises current-time to return `epoch-current-time' if 
is set (falling back to the usual current-time if not).
A macro, `epoch-with-time' is provided which allows a body to be 
executed with current-time set to an arbitrary time.
Two commands (which I may separate into their own package), 
`epoch-todo' and `epoch-agenda-todo' call their respective 
org-mode commands.
`org-read-date' is called with the tasks's SCHEDULED or DEADLINE 
time pre-populated so one can easily edit relative to that time.


Still very much a work in progress, but the two commands are 
useful for me so far.


Any ideas, suggestions, criticisms are appreciated.



Re: time-warping - retroactively marking DONE?

2020-07-07 Thread Marcin Borkowski


On 2020-07-07, at 13:26, Adam Spiers  wrote:

> Hi all,
>
> 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

org-todo-yesterday?

Hth,

-- 
Marcin Borkowski
http://mbork.pl



Re: time-warping - retroactively marking DONE?

2020-07-07 Thread Kyle Meyer
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@passepartout.tim-landscheidt.de/T/#u