From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Porter Subject: Re: counter macro in dates? Date: Wed, 23 Aug 2017 01:27:20 -0500 Message-ID: <87pobmkddj.fsf@alphapapa.net> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dkPBK-0006KH-8S for emacs-orgmode@gnu.org; Wed, 23 Aug 2017 02:30:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dkPBF-0004O3-QM for emacs-orgmode@gnu.org; Wed, 23 Aug 2017 02:30:26 -0400 Received: from [195.159.176.226] (port=56462 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dkPBF-0004Nt-Jf for emacs-orgmode@gnu.org; Wed, 23 Aug 2017 02:30:21 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dkPAz-0003Lc-1u for emacs-orgmode@gnu.org; Wed, 23 Aug 2017 08:30:05 +0200 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" To: emacs-orgmode@gnu.org Matt Price writes: > I'd love to be able generate dates dynamically using the {{{n}}} org > macro, or some other mechanism. I don't immediately see how that would > be possible but maybe someone can guide me. I'd want to do something > equivalent to this pseudo-elisp: > > (let ((base-date 2017-09-05)) > (+ base-date (* 7 {{{n}}})) > > I haven't looked into how date objects are parsed in org-mode, though, > so I have no idea how hard it would be to actually implement something > like this. Apologies to the list for practically spamming this recently, but it seems directly relevant: https://github.com/abo-abo/tiny It has built-in support for Org dates with its %(date) function. Apparently it can be used like this: m\n8|**** TODO Learning from Data Week %(+ x 2) \nSCHEDULED: <%(date "Oct 7" (* x 7))> DEADLINE: <%(date "Oct 14" (* x 7))> Which results in: **** TODO Learning from Data Week 2 SCHEDULED: <2013-10-07 Mon> DEADLINE: <2013-10-14 Mon> **** TODO Learning from Data Week 3 SCHEDULED: <2013-10-14 Mon> DEADLINE: <2013-10-21 Mon> [...]