For instance, I have the following habit "sleep before 23h"

** TODO sleep before 23h                                  
   SCHEDULED: <2019-09-07 sam. 23:00 +1d>
   :STYLE: habit

And I mark it as DONE on my agenda each time I'm going to sleep. However, whether or not I've done it before 23h, org-habit considered it as done in time since it's day-based. Is there a trick to change its behaviour so that "sleeping after 23h" in this case is considered overdue?


For starters, my suggestion would be to use DEADLINE: rather than SCHEDULED:. See The Org Manual: Deadlines and scheduling for an explanation of the distinction. Namely:

SCHEDULED Meaning: you are planning to start working on that task on the given date.


DEADLINE Meaning: the task (most likely a TODO item, though not necessarily) is supposed to be finished on that date.

You may wish to set a SCHEDULED: value as well to reflect the earliest you anticipate going to bed.


I find this question quite interesting as trying to log my sleep schedule has been a conundrum for me as well : when you get to bed isn't the time to log it, and the day after isn't accurate, really.

Also, the real info I aim for is the amount of sleep I had and if sleeping time and wake-up time are stable or not.

Trying to implement @ebpa answer gave me

** TODO sleep before 23h
   SCHEDULED: < 22:30 +1d>
   DEADLINE: < 23:00 +1d>
   :STYLE: habit

Now I'll try to get emacs/org-mode to compute sleep time ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.