emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* counter macro in dates?
@ 2017-08-17 19:25 Matt Price
  2017-08-23  6:27 ` Adam Porter
  0 siblings, 1 reply; 6+ messages in thread
From: Matt Price @ 2017-08-17 19:25 UTC (permalink / raw)
  To: Org Mode

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

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.

Thank you everyone!

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

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

* Re: counter macro in dates?
  2017-08-17 19:25 counter macro in dates? Matt Price
@ 2017-08-23  6:27 ` Adam Porter
  2017-08-23 21:02   ` Kaushal Modi
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Porter @ 2017-08-23  6:27 UTC (permalink / raw)
  To: emacs-orgmode

Matt Price <moptop99@gmail.com> 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>
[...]

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

* Re: counter macro in dates?
  2017-08-23  6:27 ` Adam Porter
@ 2017-08-23 21:02   ` Kaushal Modi
  2017-08-24  1:45     ` Adam Porter
  0 siblings, 1 reply; 6+ messages in thread
From: Kaushal Modi @ 2017-08-23 21:02 UTC (permalink / raw)
  To: Adam Porter, emacs-orgmode

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

On Wed, Aug 23, 2017 at 2:31 AM Adam Porter <adam@alphapapa.net> wrote:

>
> Apologies to the list for practically spamming this recently, but it
> seems directly relevant:
>
> https://github.com/abo-abo/tiny


+1 for tiny :)

When I discovered it, I went a bit overboard and wrote a helper fn
(modi/tiny-helper in here[1]) so that I don't have to remember the tiny
syntax. I still use tiny from time to time.

[1]:
https://github.com/kaushalmodi/.emacs.d/blob/master/setup-files/setup-tiny.el
-- 

Kaushal Modi

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

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

* Re: counter macro in dates?
  2017-08-23 21:02   ` Kaushal Modi
@ 2017-08-24  1:45     ` Adam Porter
  2017-08-24 10:39       ` Kaushal Modi
  2017-08-24 15:30       ` Kaushal Modi
  0 siblings, 2 replies; 6+ messages in thread
From: Adam Porter @ 2017-08-24  1:45 UTC (permalink / raw)
  To: emacs-orgmode

Kaushal Modi <kaushal.modi@gmail.com> writes:

> +1 for tiny :)
>
> When I discovered it, I went a bit overboard and wrote a helper fn
> (modi/tiny-helper in here[1]) so that I don't have to remember the
> tiny syntax. I still use tiny from time to time.
>
> [1]: https://github.com/kaushalmodi/.emacs.d/blob/master/setup-files/setup-tiny.el

That's very cool.  Do you think Oleh would add it to Tiny?

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

* Re: counter macro in dates?
  2017-08-24  1:45     ` Adam Porter
@ 2017-08-24 10:39       ` Kaushal Modi
  2017-08-24 15:30       ` Kaushal Modi
  1 sibling, 0 replies; 6+ messages in thread
From: Kaushal Modi @ 2017-08-24 10:39 UTC (permalink / raw)
  To: Adam Porter, emacs-org list

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

On Wed, Aug 23, 2017, 9:46 PM Adam Porter <adam@alphapapa.net> wrote:

>
> That's very cool.  Do you think Oleh would add it to Tiny?
>

Good question. I'll open an issue on that repo. When I wrote this, I wasn't
too good with git, creating branches or submitting PR's.

> --

Kaushal Modi

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

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

* Re: counter macro in dates?
  2017-08-24  1:45     ` Adam Porter
  2017-08-24 10:39       ` Kaushal Modi
@ 2017-08-24 15:30       ` Kaushal Modi
  1 sibling, 0 replies; 6+ messages in thread
From: Kaushal Modi @ 2017-08-24 15:30 UTC (permalink / raw)
  To: Adam Porter, emacs-orgmode

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

On Wed, Aug 23, 2017 at 9:46 PM Adam Porter <adam@alphapapa.net> wrote:

>
> That's very cool.  Do you think Oleh would add it to Tiny?
>

PR submitted :) https://github.com/abo-abo/tiny/pull/9
-- 

Kaushal Modi

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

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

end of thread, other threads:[~2017-08-24 15:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-17 19:25 counter macro in dates? Matt Price
2017-08-23  6:27 ` Adam Porter
2017-08-23 21:02   ` Kaushal Modi
2017-08-24  1:45     ` Adam Porter
2017-08-24 10:39       ` Kaushal Modi
2017-08-24 15:30       ` Kaushal Modi

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