On Thu, Apr 26, 2018 at 7:34 PM, Bastien <b...@gnu.org> wrote:

> Hi Andrei,
>
> Andrei Beliankou <ar...@yandex.ru> writes:
>
> > I wonder if Org-mode has a convinient function to shift a timestamp with
> > a (weekly) repeating interval by that interval.
>
> Actually the same way `org-read-date' reads the time in the timestamp
> it could also read a repeater interval, so that C-c C-s would present
> you with this repeater interval by default.
>
> Would that make sense for you?
>
>
Huh, that sounds interesting. What I did was define this function:

;; this is the one I'm currently using
(defun get-ts+7 ()
"returns a string of the form <%Y-%m-d %a> where the date elements are 7
days later
than the previous timestamp in the buffer. No error checking or anything
yet."
    (interactive)
    (let ((base-date (save-excursion
                 (re-search-backward
                  (org-re-timestamp 'all))
                 (match-string 0)))
          (result nil))

      (format-time-string "<%Y-%m-%d %a>"
                          (time-add
                           (date-to-time base-date) (days-to-time (1+ 7))))
))

And then I use this macro:

#+MACRO: ts (eval (get-ts+7))

And then my headings look like this:

* Week {{{n}}} (<2017-09-11 Mon>):Intro. On Discussion.
* Week {{{n}}} ({{{ts}}}): What is a River?
* Week {{{n}}} ({{{ts}}}): Rivers in the Broad Sweep of Time

It's not easy to look at in its org-native form, but it's pretty good on
export.

Reply via email to