26

I want to know how can I set a repetitive task for only a range of days of the week, for instance from Monday to Friday only.

1
  • 1
    AFAIK, org-habit has no support for restricting to certain days of week only.
    – Juancho
    Feb 1, 2015 at 15:03

4 Answers 4

16

This special sexp diary entry will repeat the TODO on weekdays:

** TODO On Weekdays
<%%(let ((dayname (calendar-day-of-week date)))(memq dayname '(1 2 3 4 5)))> [2015-02-01 So]
5
  • 1
    This doesn't seem to work properly. While it does cause the event to display in the agenda on weekdays, it doesn't work correctly with the repeating-todo functionality. When I mark the task as DONE, it doesn't return to the TODO state.
    – user3871
    Aug 24, 2015 at 22:04
  • 6
    The diary sexps are not meant to work with rescheduling. If you depend on this, it's probably easier to set up multiple todo entries, one per weekday.
    – mutbuerger
    Aug 26, 2015 at 8:31
  • Thanks, but I'm confused: assuming a TODO entry will be marked DONE when it's done, how is a repeating sexp useful if it doesn't cause the TODO to get rescheduled?
    – user3871
    Aug 29, 2015 at 17:47
  • Citing the Org-mode manual: "the use of diary sexp entries like <%%(diary-float t 42)> in scheduling and deadline timestamps is limited. [...] However, it will show the item on each day where the sexp entry matches".
    – mutbuerger
    Aug 30, 2015 at 6:21
  • I suppose, then, that you could use an agenda view that displays DONE items, and then manually mark it TODO and then DONE again. Too bad that the sexps can't just work with repeating items. :(
    – user3871
    Sep 2, 2015 at 7:41
4

https://github.com/oddious/org-habit-plus

What’s this?

The great org-habit module lacks a way to handle a very common type of habits, those that can/may/must be executed only on certain weekdays. There exist several workarounds like creating a habit for each day of interest, but they are less flexible and spoil the beauty of Org.

This little enhancement aims to fill the gap. It’s a fork of the original org-habit module and most of the internals are left untouched.

What works

The desired minimum.

...

How it works

As simple as specifying the weekdays (1 = Monday, 7 = Sunday, space separated), on which a habit is expected to be performed, in the :HABIT_WEEKDAYS: property.

WARNING!!!

Expect consistent behaviour only for “.+”-style habits. The “+”- and “++”-style habits are better, at least for now, to be used the original way.

2

I was currently searching for the same functionality and came across this solution from org-mode FAQ

** Daily meeting
   <%%(memq (calendar-day-of-week date) '(1 2 3 4 5))>

It works for me. I am using Emacs 27.1 on Debian 11.

0

Make a repeating entry for Monday and then use Org's timeshift to create additional entries for Tuesday to Friday.

2
  • 1
    Humm... could you expand your answer with an example? Thank you!
    – shackra
    Feb 1, 2015 at 9:06
  • 3
    @shackra For anybody still wondering, I think what he meant is just to create like five entries with the same name in parallel, just with different scheduled times. e.g. this one: emacs.stackexchange.com/questions/26610/…
    – xji
    Sep 1, 2016 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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