emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Price <moptop99@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: inserting a copy of an element at point (timestamps)
Date: Mon, 30 Nov 2015 17:59:21 -0500	[thread overview]
Message-ID: <CAN_Dec9gofDn4njKjvi0Ytrm5LTMq2+85mQS0t7yB37O=+6_4w@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 773 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1056 bytes --]

             reply	other threads:[~2015-11-30 22:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-30 22:59 Matt Price [this message]
2015-11-30 23:34 ` inserting a copy of an element at point (timestamps) John Kitchin
2015-11-30 23:42 ` Rasmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAN_Dec9gofDn4njKjvi0Ytrm5LTMq2+85mQS0t7yB37O=+6_4w@mail.gmail.com' \
    --to=moptop99@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).