emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* inserting a copy of an element at point (timestamps)
@ 2015-11-30 22:59 Matt Price
  2015-11-30 23:34 ` John Kitchin
  2015-11-30 23:42 ` Rasmus
  0 siblings, 2 replies; 3+ messages in thread
From: Matt Price @ 2015-11-30 22:59 UTC (permalink / raw)
  To: Org Mode

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-30 23:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-30 22:59 inserting a copy of an element at point (timestamps) Matt Price
2015-11-30 23:34 ` John Kitchin
2015-11-30 23:42 ` Rasmus

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).