4

I'm trying to use my Orgmode calendar via MobileOrg on my Android devices, to push events to the Google calendar, and neither sexp-formatted events nor recurring events (set up with +) seem to appear in Google calendar (for + recurring events the first one appears, but none of the subsequent ones).

The solution would seem to be to create individual entries for every occurrence of the recurring event, which will be tedious and inefficient. I assume there must be a way of harnessing the power of elisp in such a way to create a function which, when given a start date and a stop date and a time-span for recurrence [e.g. every day, every week etc.] (and, ideally, note any skipped dates, e.g. for holidays) and have that function output individual org-mode events. Has anyone done this sort of thing?

emacsomancer
  • 1,011
  • 1
  • 9
  • 16

1 Answers1

4

The solution would seem to be to create individual entries for every occurrence of the recurring event, which will be tedious and inefficient.

Why? It would be the way to gain maximum control and AFAIK this is required for repeated events that you want to transfer via e.g. org-caldav.el. The reason is that you need an UID (Unique) for each event to be able to consistently track them (though ox-ical.el does provide such an UID for repeated events set up with e.g. org-class they are ignored by at least org-caldav.el).

Fortunately, org-clone-subtree-with-time-shift has been part of Emacs for a good many years. It will set up n headings for you with a timeshift, like +1w.

Example

(with-temp-buffer
  (save-excursion (insert "* foo\n<2015-01-21 mié>"))
  (org-clone-subtree-with-time-shift 2 "+1w")
  (buffer-substring-no-properties (point-min) (point-max)))

Output

 * foo 
 <2015-01-21 mié>
 * foo
 <2015-01-28 mié>
 * foo
 <2015-02-04 mié>
rasmus
  • 2,682
  • 13
  • 20
  • `org-clone-subtree-with-time-shift` seems to be exactly what is wanted to avoid tedious and inefficient inputting of individual events. – emacsomancer Jan 21 '15 at 14:24