emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Logging previous SCHEDULED property before changing TODO state of a habit
@ 2023-10-09 19:23 Ilya Chernyshov
  2023-10-13 12:30 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Ilya Chernyshov @ 2023-10-09 19:23 UTC (permalink / raw)
  To: emacs-orgmode


Hi.

Is there anything I can do with my Org config so that every time I
change the TODO state of my habit (example below), Org logs inactive
timestamp from SCHEDULED property before TODO state change?

For example, I have this habit, which I have been forgetting to mark as
DONE/MISSED/WHATEVER for the past several days:


* TODO heading
SCHEDULED: <2023-10-05 Thu +1d>
:PROPERTIES:
:CREATED:  [2023-10-01 Sun 01:25]
:END:


Now, I want Org to log when I done the task and when I missed it, but
instead it inserts the timestamp of current time:


* TODO heading
SCHEDULED: <2023-10-08 Sun +1d>
:PROPERTIES:
:CREATED:  [2023-10-01 Sun 01:25]
:LAST_REPEAT: [2023-10-10 Tue 02:08]
:END:
:LOGBOOK:
- State "DONE"       from "TODO"       [2023-10-10 Tue 02:08]
- State "MISSED"     from "TODO"       [2023-10-10 Tue 02:08]
- State "DONE"       from "TODO"       [2023-10-10 Tue 02:08]
:END:


What I want to get instead is:


* TODO heading
SCHEDULED: <2023-10-08 Sun +1d>
:PROPERTIES:
:CREATED:  [2023-10-01 Sun 01:25]
:LAST_REPEAT: [2023-10-10 Tue 02:08]
:END:
:LOGBOOK:
- State "DONE"       from "TODO"       [2023-10-08 Sun]
- State "MISSED"     from "TODO"       [2023-10-07 Sat]
- State "DONE"       from "TODO"       [2023-10-06 Fri]
:END:


It would be awesome, if there was a placeholder in org-log-note-headings
(for example "%e") that is replaced with previous SCHEDULED
timestamp. Can we do that? Or is there a better option to achieve that?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Logging previous SCHEDULED property before changing TODO state of a habit
  2023-10-09 19:23 Logging previous SCHEDULED property before changing TODO state of a habit Ilya Chernyshov
@ 2023-10-13 12:30 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2023-10-13 12:30 UTC (permalink / raw)
  To: Ilya Chernyshov; +Cc: emacs-orgmode

Ilya Chernyshov <ichernyshovvv@gmail.com> writes:

> Is there anything I can do with my Org config so that every time I
> change the TODO state of my habit (example below), Org logs inactive
> timestamp from SCHEDULED property before TODO state change?
>
> For example, I have this habit, which I have been forgetting to mark as
> DONE/MISSED/WHATEVER for the past several days:
> ...
> Now, I want Org to log when I done the task and when I missed it, but
> instead it inserts the timestamp of current time:
> ...
> ...
> It would be awesome, if there was a placeholder in org-log-note-headings
> (for example "%e") that is replaced with previous SCHEDULED
> timestamp. Can we do that? Or is there a better option to achieve that?

There is no easy way, especially since you probably want a different
note depending on the todo keyword (scheduled time for MISSED and today
for DONE, for example).

The %t placeholder from `org-log-note-headings' is not exactly the
current time, but rather the return value of
`org-current-effective-time'.

`org-current-effective-time', is somewhat customizeable.
We allow to use the last clock out time as the timestamp via
`org-use-last-clock-out-time-as-effective-time'.

To get what you need, it will be necessary to add more customization.
For example, we can allow a user function that returns the time that
should be used. Feel free to submit a patch to that effect.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-13 12:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-09 19:23 Logging previous SCHEDULED property before changing TODO state of a habit Ilya Chernyshov
2023-10-13 12:30 ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).