[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] inserting a copy of an element at point (timestamps)

From: Matt Price
Subject: [O] inserting a copy of an element at point (timestamps)
Date: Mon, 30 Nov 2015 17:59:21 -0500

Every time I think I'm starting to learn org Mode, I find I'm actually really ignorant.

I want to write a simple function that inserts a timestamp at point for a date one week after the previous timestamp. I'm sure it's very simple. But I can't figure out how to do it.

i have this:

(defun mwp/one-week-later ()
  "add a new timestamp a week later than the previous one"

    (let ((curpos (point)))
      (re-search-backward "<[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}"  )
      (let* ((previous-ts (org-element-context)))
        (goto-char curpos)
        (INSERT COPY OF PREVIOUS-TS) ;; obviously this is fake. But what to replace it with?
        (org-timestamp-change 7 'dat)     )))

What's the real solution? Thank you,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]