2

What are (if any) the lisp functions to read and write the repeater interval part of the org-mode timestamps? (The ones at the end of the timestamp string, which are optional, e.g. +1w or +6d in <2016-03-03 Thu .+6d -3d> or [2016-01-27 Wed ++1w -2d])

If there are none such functions, how does one approach creating them?

Any way to convert them to seconds for use in arithmetic manipulations?

Drew
  • 75,699
  • 9
  • 109
  • 225

1 Answers1

3

See org-element-timestamp-parser (parses the timestamp at point, including the repeater part) and org-element-timestamp-interpreter (transforms a timestamp object back into Org syntax).

For example, calling (org-element-timestamp-parser) with the point at the "<" of "<2016-01-25 Mon 14:51 +1w>" produces

(timestamp (:type active
            :raw-value "<2016-01-25 Mon 14:51 +1w>"
            :year-start 2016
            :month-start 1
            :day-start 25
            :hour-start 14
            :minute-start 51
            :year-end 2016
            :month-end 1
            :day-end 25
            :hour-end 14
            :minute-end 51
            :begin 1
            :end 27
            :post-blank 0
            :repeater-type cumulate
            :repeater-value 1
            :repeater-unit week))

The second element of this list is a property list that can be easily accessed and changed using plist-get and plist-put.

PS: I found these by running zrgrep in the Org source directory, searching for "repeater".

PPS: I use Org-mode version 8.2.10.

Constantine
  • 9,072
  • 1
  • 34
  • 49
  • Wow! I didn't realize this is so an advanced topic, that my Org-mode version 7.8 doesn't include this function. Gotta go upgrade emacsen on all of my computers now, and still a lot of programming lays ahead of me. – Alexander Shcheblikin Jan 26 '16 at 06:15