all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Date calculations
@ 2009-12-30 12:47 Fredrik
  2009-12-30 13:08 ` Fredrik
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Fredrik @ 2009-12-30 12:47 UTC (permalink / raw)
  To: emacs-orgmode

I'm using a normal org-file as my contact register so I easier can  
link tasks to a specific person. I have also added events as birthdays  
to each contact but is there some way I can make them show up in the  
agenda with some yearly calculations?

For example a simple birthday reminder can look like this:

* <2006-12-30 ++1y> Happy Birthday!

Is there some clever way I can add a date calculation to it when it  
shows up in the agenda?

* <2006-12-30 ++1y> Happy Birthday %d years!

Regards,

Fredrik

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

* Re: Date calculations
  2009-12-30 12:47 Date calculations Fredrik
@ 2009-12-30 13:08 ` Fredrik
  2009-12-30 13:09 ` Ian Barton
  2009-12-30 13:11 ` Benjamin Andresen
  2 siblings, 0 replies; 16+ messages in thread
From: Fredrik @ 2009-12-30 13:08 UTC (permalink / raw)
  To: emacs-orgmode

Hmm reading a bit more in the manual I found that entries like this  
should work:
%%(diary-anniversary 14  5 1956) Arthur Dent is %d years old

But I can't make in show in my agenda?
The manual also samples this :
%%(org-calendar-holiday)
This works though? So any ideas on how to make the first one work?

Regards,

Fredrik


On 30 dec 2009, at 13.47, Fredrik wrote:

> I'm using a normal org-file as my contact register so I easier can  
> link tasks to a specific person. I have also added events as  
> birthdays to each contact but is there some way I can make them show  
> up in the agenda with some yearly calculations?
>
> For example a simple birthday reminder can look like this:
>
> * <2006-12-30 ++1y> Happy Birthday!
>
> Is there some clever way I can add a date calculation to it when it  
> shows up in the agenda?
>
> * <2006-12-30 ++1y> Happy Birthday %d years!
>
> Regards,
>
> Fredrik
>
>
> _______________________________________________
> 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] 16+ messages in thread

* Re: Date calculations
  2009-12-30 12:47 Date calculations Fredrik
  2009-12-30 13:08 ` Fredrik
@ 2009-12-30 13:09 ` Ian Barton
  2009-12-30 13:11 ` Benjamin Andresen
  2 siblings, 0 replies; 16+ messages in thread
From: Ian Barton @ 2009-12-30 13:09 UTC (permalink / raw)
  To: Fredrik; +Cc: emacs-orgmode

Fredrik wrote:
> I'm using a normal org-file as my contact register so I easier can link 
> tasks to a specific person. I have also added events as birthdays to 
> each contact but is there some way I can make them show up in the agenda 
> with some yearly calculations?
> 
> For example a simple birthday reminder can look like this:
> 
> * <2006-12-30 ++1y> Happy Birthday!
> 
> Is there some clever way I can add a date calculation to it when it 
> shows up in the agenda?
> 
> * <2006-12-30 ++1y> Happy Birthday %d years!
> 
> Regards,
> 
You can use diary sexps. Search the manual for "Diary-style sexp 
entries". As an example I have:

%%(diary-anniversary 3  1 2000) Ella is %d years old

in one of my org files.

Ian.

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

* Re: Date calculations
  2009-12-30 12:47 Date calculations Fredrik
  2009-12-30 13:08 ` Fredrik
  2009-12-30 13:09 ` Ian Barton
@ 2009-12-30 13:11 ` Benjamin Andresen
  2009-12-30 14:21   ` Benjamin Andresen
  2 siblings, 1 reply; 16+ messages in thread
From: Benjamin Andresen @ 2009-12-30 13:11 UTC (permalink / raw)
  To: emacs-orgmode

Hey,

Fredrik <fredrik@jumans.net> writes:

> I'm using a normal org-file as my contact register so I easier can
> link tasks to a specific person. I have also added events as birthdays
> to each contact but is there some way I can make them show up in the
> agenda with some yearly calculations?
>
> For example a simple birthday reminder can look like this:
>
> * <2006-12-30 ++1y> Happy Birthday!
>
> Is there some clever way I can add a date calculation to it when it
> shows up in the agenda?
>
> * <2006-12-30 ++1y> Happy Birthday %d years!

I used to do it the way it was done in the manual:

(info "(org)Weekly/daily agenda")
under Calendar/Diary integration

     %%(diary-anniversary 14  5 1956) Arthur Dent is %d years old

I now use bbdb which also works good and has gnus integration which is
important to me.


> Regards,
>
> Fredrik

br,
benny

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

* Re: Date calculations
  2009-12-30 13:11 ` Benjamin Andresen
@ 2009-12-30 14:21   ` Benjamin Andresen
  2009-12-30 15:05     ` Memnon Anon
  2009-12-30 15:27     ` Carsten Dominik
  0 siblings, 2 replies; 16+ messages in thread
From: Benjamin Andresen @ 2009-12-30 14:21 UTC (permalink / raw)
  To: emacs-orgmode

Hey,

Benjamin Andresen <benny@in-ulm.de> writes:

> I used to do it the way it was done in the manual:
>
> (info "(org)Weekly/daily agenda")
> under Calendar/Diary integration
>
>      %%(diary-anniversary 14  5 1956) Arthur Dent is %d years old

I can't for the life of me get this to work.

I tried emacs 22.1, 22.3, emacs 23.1 and the current CVS head.

Additionally I tried a few combination of org 5.23a, 4.12a, the newest
git HEAD and others in between. I also changed the value of
`org-agenda-include-diary' and whether or not a ~/diary file existed.
(Zero-length though).

I remember that this worked. But not at the moment.

Does anyone have this working?

br,
benny

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

* Re: Date calculations
  2009-12-30 14:21   ` Benjamin Andresen
@ 2009-12-30 15:05     ` Memnon Anon
  2009-12-30 15:27     ` Carsten Dominik
  1 sibling, 0 replies; 16+ messages in thread
From: Memnon Anon @ 2009-12-30 15:05 UTC (permalink / raw)
  To: emacs-orgmode

Benjamin Andresen <benny@in-ulm.de> writes:

>>      %%(diary-anniversary 14  5 1956) Arthur Dent is %d years old
> I can't for the life of me get this to work.
> I tried emacs 22.1, 22.3, emacs 23.1 and the current CVS head.
[...]
> Does anyone have this working?

Works fine here.

%%(diary-anniversary 10 1 1960) Geburtstag xyz: %d Jahre.

Emacs 23.1.90.1
org 6.33f

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

* Re: Re: Date calculations
  2009-12-30 14:21   ` Benjamin Andresen
  2009-12-30 15:05     ` Memnon Anon
@ 2009-12-30 15:27     ` Carsten Dominik
  2009-12-30 15:43       ` Benjamin Andresen
  1 sibling, 1 reply; 16+ messages in thread
From: Carsten Dominik @ 2009-12-30 15:27 UTC (permalink / raw)
  To: Benjamin Andresen; +Cc: emacs-orgmode


On Dec 30, 2009, at 3:21 PM, Benjamin Andresen wrote:

> Hey,
>
> Benjamin Andresen <benny@in-ulm.de> writes:
>
>> I used to do it the way it was done in the manual:
>>
>> (info "(org)Weekly/daily agenda")
>> under Calendar/Diary integration
>>
>>     %%(diary-anniversary 14  5 1956) Arthur Dent is %d years old

Hi Benjamin,

currently these lines must be all the way at the left margin, they  
cannot be indented.

- Carsten

>
> I can't for the life of me get this to work.
>
> I tried emacs 22.1, 22.3, emacs 23.1 and the current CVS head.
>
> Additionally I tried a few combination of org 5.23a, 4.12a, the newest
> git HEAD and others in between. I also changed the value of
> `org-agenda-include-diary' and whether or not a ~/diary file existed.
> (Zero-length though).
>
> I remember that this worked. But not at the moment.
>
> Does anyone have this working?
>
> br,
> benny
>
>
> _______________________________________________
> 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

- Carsten

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

* Re: Date calculations
  2009-12-30 15:27     ` Carsten Dominik
@ 2009-12-30 15:43       ` Benjamin Andresen
  2009-12-30 15:58         ` Memnon Anon
  0 siblings, 1 reply; 16+ messages in thread
From: Benjamin Andresen @ 2009-12-30 15:43 UTC (permalink / raw)
  To: emacs-orgmode

Hey Carsten,

Carsten Dominik <carsten.dominik@gmail.com> writes:

> On Dec 30, 2009, at 3:21 PM, Benjamin Andresen wrote:
>
>> Hey,
>>
>> Benjamin Andresen <benny@in-ulm.de> writes:
>>
>>> I used to do it the way it was done in the manual:
>>>
>>> (info "(org)Weekly/daily agenda")
>>> under Calendar/Diary integration
>>>
>>>     %%(diary-anniversary 14  5 1956) Arthur Dent is %d years old
>
> Hi Benjamin,
>
> currently these lines must be all the way at the left margin, they
> cannot be indented.

I'm sorry for that line, it was ambiguous. I meant to indent it for
clarity, not to represent how it's indented in my file.

I have found the culprit though.

This works:
%%(diary-anniversary 12 30 1984) Arthur Dent is %d years
                     ^   ^   ^
                     M   D   Y
This doesn't:
%%(diary-anniversary 30 12 1984) Arthur Dent is %d years
                     ^   ^   ^
                     D   M   Y

This isn't affected by any locale setting on my end.

I tried en_GB, de_DE and en_US and it will always choose the US M/D/Y
format in the org-mode file. That runs counter to the documentation
example cited above, so does anyone else see that?

>
> - Carsten

br,
benny

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

* Re: Date calculations
  2009-12-30 15:43       ` Benjamin Andresen
@ 2009-12-30 15:58         ` Memnon Anon
  2009-12-30 16:08           ` Benjamin Andresen
  0 siblings, 1 reply; 16+ messages in thread
From: Memnon Anon @ 2009-12-30 15:58 UTC (permalink / raw)
  To: emacs-orgmode

Benjamin Andresen <benny@in-ulm.de> writes:

> This works:
> %%(diary-anniversary 12 30 1984) Arthur Dent is %d years
>                      ^   ^   ^
>                      M   D   Y
> This doesn't:
> %%(diary-anniversary 30 12 1984) Arthur Dent is %d years
>                      ^   ^   ^
>                      D   M   Y

Second one is what I have here and it works as expected.

Probably related to these settings in my .emacs:

(setq european-calendar-style t)      ; obsolete!
(setq calendar-date-style 'european)  ;(info "(emacs)Date Formats")

Do you have these set, too?

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

* Re: Date calculations
  2009-12-30 15:58         ` Memnon Anon
@ 2009-12-30 16:08           ` Benjamin Andresen
  2009-12-30 19:21             ` Carsten Dominik
  0 siblings, 1 reply; 16+ messages in thread
From: Benjamin Andresen @ 2009-12-30 16:08 UTC (permalink / raw)
  To: emacs-orgmode

Memnon Anon <gegendosenfleisch@googlemail.com> writes:

> Probably related to these settings in my .emacs:
>
> (setq european-calendar-style t)      ; obsolete!
> (setq calendar-date-style 'european)  ;(info "(emacs)Date Formats")
>
> Do you have these set, too?

Thanks! If I set it to european, it works.

Should the documentation be changed to the american default? (If it is a
default and not based on the $LANG when emacs is being built.)

br,
benny

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

* Re: Re: Date calculations
  2009-12-30 16:08           ` Benjamin Andresen
@ 2009-12-30 19:21             ` Carsten Dominik
  2009-12-30 19:51               ` Benjamin Andresen
  2009-12-30 20:37               ` Memnon Anon
  0 siblings, 2 replies; 16+ messages in thread
From: Carsten Dominik @ 2009-12-30 19:21 UTC (permalink / raw)
  To: Benjamin Andresen; +Cc: emacs-orgmode

Hi Benjamin,

can you point out exactly where in the documentation this is located?

Thanks.

- Carsten

P.S.  Emacs calendar is great, but changing function call arguments  
depending on calendar style was a truly braindead decision.....


On Dec 30, 2009, at 5:08 PM, Benjamin Andresen wrote:

> Memnon Anon <gegendosenfleisch@googlemail.com> writes:
>
>> Probably related to these settings in my .emacs:
>>
>> (setq european-calendar-style t)      ; obsolete!
>> (setq calendar-date-style 'european)  ;(info "(emacs)Date Formats")
>>
>> Do you have these set, too?
>
> Thanks! If I set it to european, it works.
>
> Should the documentation be changed to the american default? (If it  
> is a
> default and not based on the $LANG when emacs is being built.)
>
> br,
> benny
>
>
> _______________________________________________
> 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

- Carsten

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

* Re: Date calculations
  2009-12-30 19:21             ` Carsten Dominik
@ 2009-12-30 19:51               ` Benjamin Andresen
  2009-12-30 22:41                 ` Carsten Dominik
  2009-12-30 20:37               ` Memnon Anon
  1 sibling, 1 reply; 16+ messages in thread
From: Benjamin Andresen @ 2009-12-30 19:51 UTC (permalink / raw)
  To: emacs-orgmode

Hey Carsten,

Carsten Dominik <carsten.dominik@gmail.com> writes:

> Hi Benjamin,
>
> can you point out exactly where in the documentation this is located?

Sure.

org-mode/doc/org.text
Line: 6643

I wouldn't know how to phrase it, but maybe a link to
(info "(emacs)Special Diary Entries") where this behaviour is explained
is the best.

     The entry looks like this:

     %%(diary-anniversary 10 31 1948) Arthur's birthday

     This entry applies to October 31 in any year after 1948; `10 31 1948'
     specifies the date.  (If you are using the European or ISO calendar
     style, the input order of month, day and year is different.)"


> Thanks.
>
> - Carsten
>
> P.S.  Emacs calendar is great, but changing function call arguments
> depending on calendar style was a truly braindead decision.....

I completely agree. Or go all the way with localization and make the
`and' macro short-circuit right to left when you run the elisp in
Israel. ;-)

br,
benny

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

* Re: Date calculations
  2009-12-30 19:21             ` Carsten Dominik
  2009-12-30 19:51               ` Benjamin Andresen
@ 2009-12-30 20:37               ` Memnon Anon
  2009-12-30 22:46                 ` Ben Finney
  2010-01-01 10:32                 ` Carsten Dominik
  1 sibling, 2 replies; 16+ messages in thread
From: Memnon Anon @ 2009-12-30 20:37 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:

> can you point out exactly where in the documentation this is located?

,----[ (info "(org)Weekly/daily agenda") ]
|      * Birthdays and similar stuff
|      #+CATEGORY: Holiday
|      %%(org-calendar-holiday)   ; special function for holiday names
|      #+CATEGORY: Ann
|      %%(diary-anniversary 14  5 1956) Arthur Dent is %d years old
|      %%(diary-anniversary  2 10 1869) Mahatma Gandhi would be %d years old
`----

These examples suggest D-M-Y, which only seems to work with the calendar
set to european style. Maybe, it would be better to change the example
to M-D-Y (I think it is more common?) and add a footnote that provides
the info that the date format is depending on calendar-date-style?

The next paragraph (Anniversaries from BBDB) on the other hand states a 
fixed order.
> Basically, you need to press `C-o anniversary <RET>' with the cursor in
> a BBDB record and then add the date in the format `YYYY-MM-DD', 
> [...]
>     1973-06-22
>     1955-08-02 wedding
>     2008-04-14 %s released version 6.01 of org-mode, %d years ago

So, if I understand it correctly, org-bbdb settled on iso format,
diary-anniversary uses either american or european style depending on
calendar-date-style. 

Thats somehow inconsistent, isn't it?

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

* Re: Re: Date calculations
  2009-12-30 19:51               ` Benjamin Andresen
@ 2009-12-30 22:41                 ` Carsten Dominik
  0 siblings, 0 replies; 16+ messages in thread
From: Carsten Dominik @ 2009-12-30 22:41 UTC (permalink / raw)
  To: Benjamin Andresen; +Cc: emacs-orgmode


On Dec 30, 2009, at 8:51 PM, Benjamin Andresen wrote:

> Hey Carsten,
>
> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
>> Hi Benjamin,
>>
>> can you point out exactly where in the documentation this is located?
>
> Sure.
>
> org-mode/doc/org.text
> Line: 6643
>
> I wouldn't know how to phrase it, but maybe a link to
> (info "(emacs)Special Diary Entries") where this behaviour is  
> explained
> is the best.
>
>     The entry looks like this:
>
>     %%(diary-anniversary 10 31 1948) Arthur's birthday
>
>     This entry applies to October 31 in any year after 1948; `10 31  
> 1948'
>     specifies the date.  (If you are using the European or ISO  
> calendar
>     style, the input order of month, day and year is different.)"


Thanks, I have made a note there.


>
>
>> Thanks.
>>
>> - Carsten
>>
>> P.S.  Emacs calendar is great, but changing function call arguments
>> depending on calendar style was a truly braindead decision.....
>
> I completely agree. Or go all the way with localization and make the
> `and' macro short-circuit right to left when you run the elisp in
> Israel. ;-)

yes.  braindead - more braidead - most braindead ... :-)

- Carsten

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

* Re: Date calculations
  2009-12-30 20:37               ` Memnon Anon
@ 2009-12-30 22:46                 ` Ben Finney
  2010-01-01 10:32                 ` Carsten Dominik
  1 sibling, 0 replies; 16+ messages in thread
From: Ben Finney @ 2009-12-30 22:46 UTC (permalink / raw)
  To: emacs-orgmode

Memnon Anon <gegendosenfleisch@googlemail.com> writes:

> ,----[ (info "(org)Weekly/daily agenda") ]
> |      * Birthdays and similar stuff
> |      #+CATEGORY: Holiday
> |      %%(org-calendar-holiday)   ; special function for holiday names
> |      #+CATEGORY: Ann
> |      %%(diary-anniversary 14  5 1956) Arthur Dent is %d years old
> |      %%(diary-anniversary  2 10 1869) Mahatma Gandhi would be %d years old
> `----
>
> These examples suggest D-M-Y, which only seems to work with the
> calendar set to european style. Maybe, it would be better to change
> the example to M-D-Y (I think it is more common?) and add a footnote
> that provides the info that the date format is depending on
> calendar-date-style?

It might be even better to use calendar style ‘iso’ in that
documentation, to be consistent with default Org usage.

> So, if I understand it correctly, org-bbdb settled on iso format,
> diary-anniversary uses either american or european style depending on
> calendar-date-style.
>
> Thats somehow inconsistent, isn't it?

Yes, that inconsistency in the Diary behaviour has been noted.

-- 
 \       “My business is to teach my aspirations to conform themselves |
  `\              to fact, not to try and make facts harmonise with my |
_o__)                   aspirations.“ —Thomas Henry Huxley, 1860-09-23 |
Ben Finney

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

* Re: Re: Date calculations
  2009-12-30 20:37               ` Memnon Anon
  2009-12-30 22:46                 ` Ben Finney
@ 2010-01-01 10:32                 ` Carsten Dominik
  1 sibling, 0 replies; 16+ messages in thread
From: Carsten Dominik @ 2010-01-01 10:32 UTC (permalink / raw)
  To: Memnon Anon; +Cc: emacs-orgmode


On Dec 30, 2009, at 9:37 PM, Memnon Anon wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
>> can you point out exactly where in the documentation this is located?
>
> ,----[ (info "(org)Weekly/daily agenda") ]
> |      * Birthdays and similar stuff
> |      #+CATEGORY: Holiday
> |      %%(org-calendar-holiday)   ; special function for holiday names
> |      #+CATEGORY: Ann
> |      %%(diary-anniversary 14  5 1956) Arthur Dent is %d years old
> |      %%(diary-anniversary  2 10 1869) Mahatma Gandhi would be %d  
> years old
> `----
>
> These examples suggest D-M-Y, which only seems to work with the  
> calendar
> set to european style. Maybe, it would be better to change the example
> to M-D-Y (I think it is more common?) and add a footnote that provides
> the info that the date format is depending on calendar-date-style?
>
> The next paragraph (Anniversaries from BBDB) on the other hand  
> states a
> fixed order.
>> Basically, you need to press `C-o anniversary <RET>' with the  
>> cursor in
>> a BBDB record and then add the date in the format `YYYY-MM-DD',
>> [...]
>>    1973-06-22
>>    1955-08-02 wedding
>>    2008-04-14 %s released version 6.01 of org-mode, %d years ago
>
> So, if I understand it correctly, org-bbdb settled on iso format,
> diary-anniversary uses either american or european style depending on
> calendar-date-style.
>
> Thats somehow inconsistent, isn't it?


Hi Memnon,


Org-mode consistently uses ISO format, I believe.  I chose it  
precisely in order
to make sure there could be no misunderstanding in what these dates  
mean.

I cannot change the behavior of the calendar functions....

- Carsten

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

end of thread, other threads:[~2010-01-01 10:32 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-30 12:47 Date calculations Fredrik
2009-12-30 13:08 ` Fredrik
2009-12-30 13:09 ` Ian Barton
2009-12-30 13:11 ` Benjamin Andresen
2009-12-30 14:21   ` Benjamin Andresen
2009-12-30 15:05     ` Memnon Anon
2009-12-30 15:27     ` Carsten Dominik
2009-12-30 15:43       ` Benjamin Andresen
2009-12-30 15:58         ` Memnon Anon
2009-12-30 16:08           ` Benjamin Andresen
2009-12-30 19:21             ` Carsten Dominik
2009-12-30 19:51               ` Benjamin Andresen
2009-12-30 22:41                 ` Carsten Dominik
2009-12-30 20:37               ` Memnon Anon
2009-12-30 22:46                 ` Ben Finney
2010-01-01 10:32                 ` Carsten Dominik

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.