From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Manipulating Dates Automatically in a Headline Date: Thu, 14 Aug 2014 21:14:02 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XI65s-0001L2-82 for emacs-orgmode@gnu.org; Thu, 14 Aug 2014 21:14:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XI65m-0000mC-Hf for emacs-orgmode@gnu.org; Thu, 14 Aug 2014 21:14:12 -0400 Received: from mail-qa0-x230.google.com ([2607:f8b0:400d:c00::230]:50315) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XI65m-0000ll-CA for emacs-orgmode@gnu.org; Thu, 14 Aug 2014 21:14:06 -0400 Received: by mail-qa0-f48.google.com with SMTP id m5so1610229qaj.7 for ; Thu, 14 Aug 2014 18:14:05 -0700 (PDT) In-Reply-To: (Matt Price's message of "Wed, 13 Aug 2014 09:37:05 -0400") 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: Matt Price Cc: Org Mode Matt Price writes: I think this is approximately what you want: #+BEGIN_SRC emacs-lisp (defun insert-ts+1w () "Insert a timestamp at point that is one week later than the last timestamp found in the buffer." (interactive) (let ((last-ts (car (last (org-element-map (org-element-parse-buffer) 'timestamp (lambda (timestamp) (org-element-property :raw-value timestamp))))))) (insert last-ts) (backward-char 2) (org-timestamp-change +7 'day) )) #+END_SRC It is an interactive command you can run with M-x insert-ts+1w at the point you want to insert the new headline. > It's been a couple of days so I'll try restate this question more > clearly. I'm hoping it's possible to do something like this: > > * Week one (<2014-09-09>) > * Week two (EVALUATE A LISP EXPRESSION THAT INSERTS A TIMESTAMP ONE > WEEK LATER THAN LAST TIMESTAMP FOUND IN BUFFER) > > I don't have much experience with babel so I'm not sure how to do > this, but if it's possible I would love some hints. Thanks as always, > > Matt > > > On Mon, Aug 11, 2014 at 2:20 PM, Matt Price wrote: >> Hi Everyone, >> >> I've asked this before, but that was a year or two ago and am hoping >> someone has an idea now, perhaps involving babel or something. >> >> every year at this time I rewrite a set of syllabi. I do a lot of >> moving htings around while i'm oding it, and at the end I have to >> enter a whole bunch of dates somewhat laboriously. I have headlines >> that look about like either like this: >> >> ----------------- >> * Outline >> ** Week 1: Topic Title (<2013-09-10>) >> Longish Description >> *** Reading >> - Article 1 >> - Article 2 >> *** Lab >> *** Notes >> ----------------------------------- >> >> or like this: >> ---------------------- >> * Outline >> ** Week 1: <2013-09-09> >> *** Seminar: Technology and Society (<2013-09-10>) >> *** Reading >> - Article 1 >> - Article 2 >> *** Plenary: Global Citizenship (<2013-09-13>) >> -------------------- >> >> I would like to replace the timestamps with code that dynamically >> generates timestamps based on the value either in the last sibling >> headline, or the parent headline. It seems to me this ought to be >> possible, but I'm not at all sure how to do it. i would really >> appreciate any guidance. thanks! >> >> Matt > > -- ----------------------------------- John Kitchin Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu