Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using org-capture-templates to schedule a TODO for the day after today

Tags:

emacs

org-mode

In org-mode, I know how to create a todo and use the timestamp so that it is scheduled for today. How do I schedule it for tomorrow? Unfortunately I don't know Elisp and don't have time right now to learn it. Here is my .emacs file:

 (setq org-capture-templates
      '(("t" "Agenda Todo" entry
     (file+headline "c:/Org/agenda.org" "Agenda")
     "\n\n** TODO %?\nSCHEDULED: <%<%Y-%m-%d %a>>" 
     :empty-lines 1)

I would need to replace the %m-%d %a with a value incremented by one day.

like image 812
Nathan Fowler Avatar asked Nov 02 '11 20:11

Nathan Fowler


3 Answers

Working off Juancho's answer* I was able to come up with a valid timestamp.

The following will provide an org-created timestamp.

"[...]SCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+1d\"))" 

org-read-date generates a date and +1d shifts it one day in the future. nil t tells it to not include HH:MM time and to convert the date into an internal TIME representation.

org-insert-time-stamp takes TIME and converts it to a timestamp using the normal org-mode format (including weekday abbreviation)

*The answer does not work because <%(org-read-date nil nil \"+1d\")>" results in <YYYY-MM-DD>


Update

A timestamp of is now valid in Org mode (it was added to allow for entering timestamps from outside org-mode where they would not automatically be able to calculate the day of the week I believe).

Therefore Juancho's answer would work as well.

like image 57
Jonathan Leech-Pepin Avatar answered Nov 20 '22 11:11

Jonathan Leech-Pepin


This should work for your template string:

"\n\n** TODO %?\nSCHEDULED: <%(org-read-date nil nil \"+1d\")>"

org-read-date generates a timestamp; +1d means tomorrow.

like image 22
Juancho Avatar answered Nov 20 '22 10:11

Juancho


And further more, if you want a repeatable template, which generates a time stamp like:

SCHEDULED: <2012-08-17 Fri .+1d>

you may use this one:

SCHEDULED:%(org-insert-time-stamp (org-read-date nil t) nil nil nil nil \" .+1d\")
like image 44
kevin zeng Avatar answered Nov 20 '22 11:11

kevin zeng