AbstProcDo · 2022-09-08 23:53
I try insert a timestamp to org-todo as:
(advice-add 'org-todo :after (lambda ()
(insert "\n"
(format-time-string "[%Y-%m-%d %a %H:%M]" (current-time)))
))
Test it with (org-todo 'done) but it report various errors.
graduale · 2022-09-09 00:58
What are you trying to do? If it's just logging changes of todo states, you can simply set the value of `org-todo-keywords` to make that happen: e.g. try putting this:
#+TODO: TODO(t) | DONE(d!)
at the top of your buffer, calling `org-ctrl-c-ctrl-c` with point on that line, and then call `(org-todo 'done)` with point on a headline. You will see the time stamp added automatically.
AbstProcDo · 2022-09-09 01:32
thank you
[deleted] · 2022-09-09 03:21
[removed]
publicvoit · 2022-09-09 06:20
In addition to that, `org-expiry` has some great logging functionality in that direction.
TiMueller · 2022-09-09 09:52
Maybe I misunderstand what you want to do (I'm no programmer and relatively new to emacs), but wouldn't `(setq org-log-done 'time)` do the right thing?
graduale · 2022-09-09 15:43
Ooh, I didn't know about `org-expiry`. Thanks!
AbstProcDo · 2022-09-13 01:34
I tried a solution and it work well as:
(advice-add 'org-todo :after (lambda (&rest args)
(end-of-line)
(insert "\n"
(format-time-string "[%Y-%m-%d %a %H:%M]" (current-time)))
))