emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Relative dates with sexep
@ 2010-09-16 16:27 julien cubizolles
  2010-09-17  8:01 ` Eric S Fraga
  0 siblings, 1 reply; 6+ messages in thread
From: julien cubizolles @ 2010-09-16 16:27 UTC (permalink / raw)
  To: org-mode

I'm trying to specify a date relative to another date in an org file.
I've tried to adapt one of the examples from worg, with :

 <%%(= 7 (- (calendar-absolute-from-gregorian date)
            (calendar-absolute-from-gregorian (02 02 2010))))>

to get the date one week after the 2nd of february 2010. Bad sexp...

What should I use ?

Julien.

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

* Re: Relative dates with sexep
  2010-09-16 16:27 Relative dates with sexep julien cubizolles
@ 2010-09-17  8:01 ` Eric S Fraga
  2010-09-17 14:10   ` julien cubizolles
  2010-09-17 14:41   ` julien cubizolles
  0 siblings, 2 replies; 6+ messages in thread
From: Eric S Fraga @ 2010-09-17  8:01 UTC (permalink / raw)
  To: julien cubizolles; +Cc: org-mode

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

On Thu, 16 Sep 2010 18:27:18 +0200, julien cubizolles <j.cubizolles@free.fr> wrote:
> 
> I'm trying to specify a date relative to another date in an org file.
> I've tried to adapt one of the examples from worg, with :
> 
>  <%%(= 7 (- (calendar-absolute-from-gregorian date)
>             (calendar-absolute-from-gregorian (02 02 2010))))>
> 
> to get the date one week after the 2nd of february 2010. Bad sexp...

Quote the date: ... '(02 02 2010)
as it is trying to evaluate the function "02" otherwise.

[-- Attachment #2: Type: text/plain, Size: 75 bytes --]

-- 
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Relative dates with sexep
  2010-09-17  8:01 ` Eric S Fraga
@ 2010-09-17 14:10   ` julien cubizolles
  2010-09-17 14:41   ` julien cubizolles
  1 sibling, 0 replies; 6+ messages in thread
From: julien cubizolles @ 2010-09-17 14:10 UTC (permalink / raw)
  To: e.fraga; +Cc: org-mode

Le vendredi 17 septembre 2010 à 09:01 +0100, Eric S Fraga a écrit :
>  get the date one week after the 2nd of february 2010. Bad sexp...
> 
> Quote the date: ... '(02 02 2010)
> as it is trying to evaluate the function "02" otherwise.

Thanks, it works.

Julien.

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

* Re: Relative dates with sexep
  2010-09-17  8:01 ` Eric S Fraga
  2010-09-17 14:10   ` julien cubizolles
@ 2010-09-17 14:41   ` julien cubizolles
  2010-09-18 19:03     ` Eric S Fraga
  1 sibling, 1 reply; 6+ messages in thread
From: julien cubizolles @ 2010-09-17 14:41 UTC (permalink / raw)
  To: e.fraga; +Cc: org-mode

Le vendredi 17 septembre 2010 à 09:01 +0100, Eric S Fraga a écrit :
> On Thu, 16 Sep 2010 18:27:18 +0200, julien cubizolles <j.cubizolles@free.fr> wrote:
> > 
> > I'm trying to specify a date relative to another date in an org file.
> > I've tried to adapt one of the examples from worg, with :
> > 
> >  <%%(= 7 (- (calendar-absolute-from-gregorian date)
> >             (calendar-absolute-from-gregorian (02 02 2010))))>
> > 
> > to get the date one week after the 2nd of february 2010. Bad sexp...
> 
> Quote the date: ... '(02 02 2010)
> as it is trying to evaluate the function "02" otherwise.

I'm trying to make it reusable by defining a function in my .emacs :

(defun diary-relative (n day)
  "Diary entry that will always appear N days from day"
  (=
   (calendar-absolute-from-gregorian date)
   (+ n (calendar-absolute-from-gregorian day))))

I try to use it with a sexp like :
<%%(diary-relative (7 '(09 15 2010)))>

which doesn't work. I really need to seriously read about lisp
programming...

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

* Re: Relative dates with sexep
  2010-09-17 14:41   ` julien cubizolles
@ 2010-09-18 19:03     ` Eric S Fraga
  2010-09-19  8:40       ` julien cubizolles
  0 siblings, 1 reply; 6+ messages in thread
From: Eric S Fraga @ 2010-09-18 19:03 UTC (permalink / raw)
  To: julien cubizolles; +Cc: org-mode

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

On Fri, 17 Sep 2010 16:41:55 +0200, julien cubizolles <j.cubizolles@free.fr> wrote:
> 
> Le vendredi 17 septembre 2010 à 09:01 +0100, Eric S Fraga a écrit :
> > On Thu, 16 Sep 2010 18:27:18 +0200, julien cubizolles <j.cubizolles@free.fr> wrote:
> > > 
> > > I'm trying to specify a date relative to another date in an org file.
> > > I've tried to adapt one of the examples from worg, with :
> > > 
> > >  <%%(= 7 (- (calendar-absolute-from-gregorian date)
> > >             (calendar-absolute-from-gregorian (02 02 2010))))>
> > > 
> > > to get the date one week after the 2nd of february 2010. Bad sexp...
> > 
> > Quote the date: ... '(02 02 2010)
> > as it is trying to evaluate the function "02" otherwise.
> 
> I'm trying to make it reusable by defining a function in my .emacs :
> 
> (defun diary-relative (n day)
>   "Diary entry that will always appear N days from day"
>   (=
>    (calendar-absolute-from-gregorian date)
>    (+ n (calendar-absolute-from-gregorian day))))
> 
> I try to use it with a sexp like :
> <%%(diary-relative (7 '(09 15 2010)))>
> 
> which doesn't work. I really need to seriously read about lisp
> programming...

Possibly! ;-)

Try <%%(diary-relative 7 '(09 15 2010))>
as the arguments to a function should not be in ()s.

[-- Attachment #2: Type: text/plain, Size: 75 bytes --]

-- 
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Relative dates with sexep
  2010-09-18 19:03     ` Eric S Fraga
@ 2010-09-19  8:40       ` julien cubizolles
  0 siblings, 0 replies; 6+ messages in thread
From: julien cubizolles @ 2010-09-19  8:40 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: org-mode

Le samedi 18 septembre 2010 à 20:03 +0100, Eric S Fraga a écrit :

> > (defun diary-relative (n day)
> >   "Diary entry that will always appear N days from day"
> >   (=
> >    (calendar-absolute-from-gregorian date)
> >    (+ n (calendar-absolute-from-gregorian day))))
> > 
> > I try to use it with a sexp like :
> > <%%(diary-relative (7 '(09 15 2010)))>
> > 
> > which doesn't work. I really need to seriously read about lisp
> > programming...
> 
> Possibly! ;-)
> 
> Try <%%(diary-relative 7 '(09 15 2010))>
> as the arguments to a function should not be in ()s.

Thanks, it works.

Julien.

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

end of thread, other threads:[~2010-09-19  8:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-16 16:27 Relative dates with sexep julien cubizolles
2010-09-17  8:01 ` Eric S Fraga
2010-09-17 14:10   ` julien cubizolles
2010-09-17 14:41   ` julien cubizolles
2010-09-18 19:03     ` Eric S Fraga
2010-09-19  8:40       ` julien cubizolles

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