From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Price Subject: inserting a copy of an element at point (timestamps) Date: Mon, 30 Nov 2015 17:59:21 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=94eb2c07f940dc73090525c9fdd9 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38584) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3XPm-0000Bl-QY for emacs-orgmode@gnu.org; Mon, 30 Nov 2015 17:59:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3XPl-000157-QH for emacs-orgmode@gnu.org; Mon, 30 Nov 2015 17:59:22 -0500 Received: from mail-io0-x236.google.com ([2607:f8b0:4001:c06::236]:33843) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3XPl-000153-Kz for emacs-orgmode@gnu.org; Mon, 30 Nov 2015 17:59:21 -0500 Received: by ioir85 with SMTP id r85so191000302ioi.1 for ; Mon, 30 Nov 2015 14:59:21 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode --94eb2c07f940dc73090525c9fdd9 Content-Type: text/plain; charset=UTF-8 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 --94eb2c07f940dc73090525c9fdd9 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Every time I think I'm starting to learn org= Mode, I find I'm actually really ignorant.

I want to wri= te 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&= #39;t figure out how to do it.

i have this:

(defun mwp/one-week-later ()
=C2=A0 "add a new timestamp a we= ek later than the previous one"

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

What's the real solution? Thank you,
M= att

--94eb2c07f940dc73090525c9fdd9--