Try this. You may want use <> intead of [], and you can see org-re-timestamp for other options than all.
(defun insert-ts+7 () (interactive) (insert (concat "[" (save-excursion (re-search-backward (org-re-timestamp 'all)) (match-string 0))) "]") (org-timestamp-change 7 'day)) Matt Price writes: > 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" > > (interactive) > (save-excursion > (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, > Matt -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu