Emacs org-mode, repeat tasks M-F but not weekends?
Asked Answered
C

4

40

I have tasks that I do every day (e.g bugzilla triage), but I only do those Monday to friday. Not on the weekends.

When I use something like this:

SCHEDULED: <2015-02-07 Sat ++1d>

It repeats it every day, including weekends. Can I change this?

Cabot answered 6/2, 2015 at 16:3 Comment(0)
L
33

If you just need a reminder, and don't need to mark them as 'DONE' in your org-file, you could use the calendar integration for these situations.

** Triage Bugzilla Entries 09:00-10:00
   <%%(memq (calendar-day-of-week date) '(1 2 3 4 5))>

This will insert an entry into your daily agenda for weekdays only, but not a task.

Lyudmila answered 11/2, 2015 at 16:25 Comment(1)
Thanks! To create a task I just set "TODO" in the init of phrase, like the following: ** TODO Daily 13:45-14:00 <%%(memq (calendar-day-of-week date) '(1 2 3 4 5))>Burkholder
L
13

One way is to simply have a TODO for each week day, eg:

* TODO My task  
  SCHEDULED: <2015-02-09 Mon ++1w>

* TODO My task  
  SCHEDULED: <2015-02-10 Tue ++1w>

This is different than another answer:

* TODO My task
  SCHEDULED: <2015-02-09 Mon ++1w>
  SCHEDULED: <2015-02-10 Tue ++1w>
  SCHEDULED: <2015-02-11 Wed ++1w>
  SCHEDULED: <2015-02-12 Thu ++1w>
  SCHEDULED: <2015-02-13 Fri ++1w>

Which has an issue, as pointed out by someone:

There is an issue with this. When I close a task, it moves all the scheduled items forward by a week, not just the one that is due :-/

This issue occurs because all timestamps are associated with one TODO.

Lieselotteliestal answered 14/9, 2020 at 14:37 Comment(0)
C
11

Unfortunately, org-mode doesn't seem to support this in a simple command, but you can replicate this by setting up multiple weekly repeats for the same item like so:

* TODO My task
  SCHEDULED: <2015-02-09 Mon ++1w>
  SCHEDULED: <2015-02-10 Tue ++1w>
  SCHEDULED: <2015-02-11 Wed ++1w>
  SCHEDULED: <2015-02-12 Thu ++1w>
  SCHEDULED: <2015-02-13 Fri ++1w>
Convolution answered 6/2, 2015 at 17:52 Comment(3)
There is an issue with this. When I close a task, it moves all the scheduled items forward by a week, not just the one that is due :-/Cabot
So it does, I don't recall it doing that previously. Best I got for you then is to create a different task for each day (which is even worse): * TODO My Task SCHEDULED: <2015-02-09 Mon ++1w> * TODO My Task SCHEDULED: <2015-02-10 Tue ++1w> etcConvolution
Thank you for your comment. In the mean time I found a workaround. I schedule it daily, but I make it an org-habbit. So I don't see the task days ahead. On saturday/sunday I don't use my emacs so I see the task next on monday when I get back to the office. Kinda works out well.Cabot
R
1

There is the Habit Plus package, at https://github.com/myshevchuk/org-habit-plus, which augments the Habits functionality in Org Mode.

See Org Mode Habits in the manual: https://orgmode.org/manual/Tracking-your-habits.html

From the Readme.org at the Habits Plus github page:

Installation

As simple as putting the org-habit-plus.el into the load path and adding org-habit-plus to the org-modules list.

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.

So, first you would enable the Habits module in Org and set your task as a habit, specifying how often it repeats. See the Org manual link above for details.

Then you would install Habits Plus. See the github page for the org-habit-plus.el file.

Then you would add a :HABIT_WEEKDAYS: property to your habit and give that property a value of 1 2 3 4 5 to indicate it should be completed Monday through Friday.

Refugia answered 26/3, 2023 at 17:20 Comment(1)
Cool, thanks! This is the best answer, and the only one which doesn't compromise on having a single TODO entry which can advance from day to day and skip the weekend! However I think this should be submitted upstream as an additional feature in org-habit instead of being kept in a divergent fork which doesn't keep pace with upstream. I've submitted github.com/myshevchuk/org-habit-plus/issues/4 about this.Bentlee

© 2022 - 2024 — McMap. All rights reserved.