When you have:

(setq org-agenda-include-diary t)

set, then an entry in the ~/diary file like this:

%%(org-anniversary 1950 02 14) Bob's %d%s birthday

displays as:

Diary:    Bob's 65th birthday

in the Org agenda.

How do I get the same effect - reporting the number of repetitions whether it be measured in years or days or whatever - using normal Org syntax in an .org file so that I can also take advantage of other Org features such as TODOs etc?

None of the following expand the %d or %s:

* Bob's %d%s birthday
  <1950-02-14 Tue +1y>

* Bob's %d%s birthday
  <%%(org-anniversary 1950 02 14) Bob's %d%s birthday>

* Bob's %d%s birthday
  <%%(org-anniversary 1950 02 14)> Bob's %d%s birthday

There is a chapter on the weekly/daily agenda in the org-mode manual that tells you how to do this (modified for brevity; emphasis mine):

If you are using the diary only for sexp entries and holidays, it is faster to not use (setq org-agenda-include-diary t), but instead to copy or even move the entries into an Org file. Org mode evaluates diary-style sexp entries, and does it faster because there is no overhead for first creating the diary display. Note that the sexp entries must start at the left margin, no whitespace is allowed before them. For example, the following segment of an Org file will be processed and entries will be made in the agenda:

* Birthdays
%%(org-anniversary 1956  5 14) Arthur Dent is %d years old
%%(org-anniversary 1869 10  2) Mahatma Gandhi would be %d years old

For your specific example, you need to do:

* Bob's birthday
%%(org-anniversary 1950 02 14) Bob's %d%s birthday

This entry will show up in the agenda as follows:

Week-agenda (W07):
Monday      9 February 2015 W07
Saturday   14 February 2015
  birthdays:  Bob's 65th birthday

Additional info

I found this information by

  1. Accessing the org-mode manual via

    C-h i m org mode RET

  2. Searching the manual for occurrences of org-anniversary via

    C-s org-anniversary C-s C-s C-s ...

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.