Weekly repeating tasks emacs org-mode - emacs

I want to track habits using org-mode. For example, I want to do exercise 3 times every week. Is there a way to schedule 3 times a task every week irrespective of the date in org-mode?

You should be able to more or less do that using org habit tracking (See: Org-Habits).
To load org-habits you would need to add it to org-modules
(add-to-list 'org-modules "org-habit")
Then:
Use C-c C-s to set SCHEDULED.
Use C-c C-t to set your exercise TODO.
Use C-c C-x p to have the STYLE Property habit (add in any other properties as desired as well).
Now the lines like this should have be appended after the title:
:PROPERTIES:
:STYLE: habit
:END:
A single habit should suffice, it will not be exactly 3 times per week, but over time it will average out to such. If you use a scheduled repeater that is .+2d/3d you will be prompted to perform the habit no more often than every second day, and no less often than every 3. (This averages out to 2.9 times per week if you continue it long enough. Over 6 weeks (42 days) you would complete it at least 14 times, at most 21, or 17.5 on average. 18 times in 6 weeks would be 3x per week).
Your final habit should look something like this initially, as you complete it DONE logging will be added in and the last-repeat will be kept track of as a property:
** TODO Exercise
SCHEDULED: <2012-01-06 Fri .+2d/3d>
:PROPERTIES:
:STYLE: habit
:END:
Note: If you get the error Symbol's value as variable is void: org-modules when trying to load the org-habit module, you might want to try the following instead:
(require 'org)
(require 'org-install)
(add-to-list 'org-modules "org-habit")

You can use a timestamp with repeater interval as described in the
manual.
A timestamp may contain a _repeater interval_, indicating that it
applies not only on the given date, but again and again after a
certain interval of N days (d), weeks (w), months (m), or years
(y). The following will show up in the agenda every Wednesday:
* Pick up Sam at school <2007-05-16 Wed 12:30 +1w>

I can't see any way to do this with one entry. The way I do similar things is to create a special TODO sequence for is, say (sequence ('HABIT' '|' 'CHECK')) with setq org-todo-keywords
Then simply write three entries, each on a week repeat
* HABIT Monday workout
DEADLINE: <2012-01-09 Mon +1w>
* HABIT Wednessday workout
DEADLINE: <2012-01-11 Wed +1w>
* HABIT Friday workout
DEADLINE: <2012-01-06 Fri +1w>
It's not that clean, but it works.

Related

org mode repeated task up to a certain date/after x number of occurrences

I am new to org-mode, and I am currently learning how to use the habit/TODO features. I would like to add a repeated task that will stop after a certain number of occurrences, or up to a certain date.
If I look here, it seems I can use :PROPERTIES: as in
** TODO Shave
SCHEDULED: <2009-10-17 Sat .+2d/4d>
:PROPERTIES:
:STYLE: habit
:LAST_REPEAT: [2009-10-19 Mon 00:36]
:END:
However, C-c C-x p does not give me LAST_REPEAT option, and I was wondering what I can do.
The "LAST_REPEAT" property records when the habit was last done, it isn't "repeat up to this date". AFAICT there isn't a way of specifying to repeat something N times or up until a specific date.
When you press TAB at the Property: prompt, you get a list of possible completions, but you are not limited to them. You can always type LAST_REPEAT at the Property: prompt (and it will add it to the completion list as well).

org-mode: Schedule a task multiple times

Suppose I plan to meet with someone multiple times, but not on a regular schedule that would allow me to set it as a repeating task. I can type in something like
** TODO Meeting with Gus
SCHEDULED: <2014-04-25 FRI 10:00-10:30>
SCHEDULED: <2014-04-28 MON 15:30-16:00>
Scheduling the first meeting using C-c C-s (org-schedule) is easy enough. I cannot find a way to schedule the second without typing everything in by hand. If I hit C-c C-s again, it changes the time of the first meeting rather than scheduling a second meeting. Is there a more efficient way to do this?
How about:
** Meet with a dude
<2014-04-25 Fri 13:00-13:30>
<2014-04-27 Sun 14:00-14:30>
<2014-04-29 Tue 10:00-10:30>
<2014-05-02 Fri 08:00-08:30>
This will show up in your agenda at the indicated times.

Org-mode: timestamp + effort -> time range

I liked the question and answer at emacs - org-mode: creation time range from effort estimate - Stack Overflow. It is regarding taking a scheduled item and effort estimate and producing a time range.
I wanted a slightly different result, but I can't see how to modify it (I imagine modifying to org-deadline would be easy). Instead of a Scheduled item, I wanted to act on simply a Timestamp.
In other words, (cutting, pasting and removing Scheduled: from the linked question),
* TODO Sample todo
<2014-04-18 Fr 10:00>
:PROPERTIES:
:Effort: 1h
:END:
would become
* TODO Sample todo
<2014-04-18 Fr 10:00-11:00>
:PROPERTIES:
:Effort: 1h
:END:
I considered org-time-stamp and org-add-planning-info, but with no success.
Assistance appreciated.

Wrong sorting of items with repeated timestamps in agenda view?

I am using Emacs org-mode. Assume it is 2012-11-10 (today) and I have a TODO item:
**** LATER [#D] call John :phone:
SCHEDULED: <2012-07-23 Mon .+1m>
- State "DONE" from "TODO" [2012-06-23 Sat 12:21]
:PROPERTIES:
:LAST_REPEAT: [2012-06-23 Sat 12:21]
:END:
In the agenda view that I get with Ctrl-c a a this shows up as:
TODO: Sched.19x: LATER [#D] call John :phone:
and is sorted among the other items that have a SCHEDULED date 19 days ago. However, the item above has not been worked on for almost four months, so it should actually be sorted among the items SCHEDULED on <2012-07-23 Mon> (~110 days ago).
I consider this a bug, but I wanted to know whether there is any option I could try to fix that behavior. I have searched the internet for over an hour but did not find a solution.
It's not a bug but the expected behavior.
You scheduled the task with the repeated interval
SCHEDULED: <2012-07-23 Mon .+1m>
which means that the task is kinda re-scheduled every month. The last time it was 2012-10-27, 19 days ago.
You can remove the repeated interval
SCHEDULED: <2012-07-23 Mon>
then the task will be shown as scheduled 110 days ago.

Emacs org-mode scheduling an item multiple times a day?

I want to schedule a task in emacs org-mode to show up multiple times during the day.
Edit: as an example suppose I want yo call my wife every 2 hours during the day.
According to the Org Mode manual on Repeated Tasks there is an hourly repeater:
In the following example
** TODO Pay the rent
DEADLINE: <2005-10-01 Sat +1m>
the +1m is a repeater; the intended interpretation is that the task
has a deadline on <2005-10-01> and repeats itself every (one) month
starting from that time. You can use yearly, monthly, weekly, daily
and hourly repeat cookies by using the y/w/m/d/h letters.
You may use something like that:
* TODO Call Wife
DEADLINE: <2013-02-17 Sun 16:00 +2h>
Unfortunately, I've noticed that special repeater modifiers (++ and .+) do not work properly for hourly repeaters. The manual says:
** TODO Call Father
DEADLINE: <2008-02-10 Sun ++1w>
Marking this DONE will shift the date by at least one week,
but also by as many weeks as it takes to get this date into
the future. However, it stays on a Sunday, even if you called
and marked it done on Saturday.
Based on this, you would expect that marking an entry with an hourly repeater (such as the one above) DONE would "shift time by at least n hours but also as many hours as it takes to get this date into the future".
However, here's what I got after marking both entries DONE:
** TODO Call Father
DEADLINE: <2013-03-03 Sun ++1w>
- State "DONE" from "TODO" [2013-02-25 Mon 23:06]
:PROPERTIES:
:LAST_REPEAT: [2013-02-25 Mon 23:06]
:END:
** TODO Call Wife
DEADLINE: <2013-02-17 Sun 18:00 ++2h>
- State "DONE" from "TODO" [2013-02-25 Mon 23:06]
:PROPERTIES:
:LAST_REPEAT: [2013-02-25 Mon 23:06]
:END:
As you can see, the time in the second entry has shifted to 18:00, but the date is still the same.
Concerning an approach for creating repeating items explicitly another feature could be useful. The manual says:
An alternative to using a repeater is to create a number of copies of
a task subtree, with dates shifted in each copy. The command C-c C-x c
was created for this purpose, it is described in Structure editing.
But unfortunately, it doesn't work with hours.
Information in this post based on Org Mode version 7.9.3.e.
In the absence of hour/minute level repeaters, if the interval is not too small, you might add multiple timestamps for the hours, while using the other facilities for repeated items:
** Testentry
<2012-01-19 Do 10:00 +1w>
<2012-01-19 Do 12:00 +1w>
The resulting agenda view
Thursday 19 January 2012
Calendar: 10:00...... Testentry
Calendar: 12:00...... Testentry
[...]
Thursday 26 January 2012
8:00...... ----------------
Calendar: 9:45-10:00 XXXXXXXXXXXXXX :OFFICE:
10:00......
Calendar: 10:00...... Testentry
10:00...... ----------------
Calendar: 12:00...... Testentry
[...]