emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Using properties for diary-anniversaries
@ 2011-01-23 14:36 lecodesportif
  2011-01-23 21:03 ` Nick Dokos
  2011-01-24  1:16 ` Nick Dokos
  0 siblings, 2 replies; 12+ messages in thread
From: lecodesportif @ 2011-01-23 14:36 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I have an anniversary list in Org Mode where entries have this format:

* John
  :PROPERTIES:
  :Name: John
  :Birthday: 5 4 1900
  :END:

I would like to add the "Birthday" and "Name" properties to Org Agenda
automatically. What I have so far is:

%%(apply 'diary-anniversary (read (org-entry-get nil "Birthday"))) John

When I enter this line right after the properties, the anniversary is
added at the correct date in the agenda. But I still have to enter the
name manually.

Is there a way to have the "Name" property added to the diary text
automatically? Can this be done for all entries in the list by adding
code at the top of the org file?

-- 
http://www.fastmail.fm - The way an email service should be

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

* Re: Using properties for diary-anniversaries
  2011-01-23 14:36 Using properties for diary-anniversaries lecodesportif
@ 2011-01-23 21:03 ` Nick Dokos
  2011-01-23 23:04   ` lecodesportif
  2011-01-24  1:16 ` Nick Dokos
  1 sibling, 1 reply; 12+ messages in thread
From: Nick Dokos @ 2011-01-23 21:03 UTC (permalink / raw)
  To: lecodesportif; +Cc: nicholas.dokos, emacs-orgmode

lecodesportif@eml.cc wrote:

> 
> I have an anniversary list in Org Mode where entries have this format:
> 
> * John
>   :PROPERTIES:
>   :Name: John
>   :Birthday: 5 4 1900
>   :END:
> 
> I would like to add the "Birthday" and "Name" properties to Org Agenda
> automatically. What I have so far is:
> 
> %%(apply 'diary-anniversary (read (org-entry-get nil "Birthday"))) John
> 
> When I enter this line right after the properties, the anniversary is
> added at the correct date in the agenda. But I still have to enter the
> name manually.
> 
> Is there a way to have the "Name" property added to the diary text
> automatically? Can this be done for all entries in the list by adding
> code at the top of the org file?

Not really an answer to your question - it's a different method that I
find convenient. I use bbdb for contacts and so I prefer to add
birthday/anniversary information to selected bbdb entries. Then one of
the org files in my org-agenda-files includes the following entry:

--8<---------------cut here---------------start------------->8---
#+CATEGORY: Anniv
%%(org-bbdb-anniversaries)
--8<---------------cut here---------------end--------------->8---

This causes entries in my agenda like this:

,----
| Friday     28 January 2011
|   ...
|   Anniv:      Birthday: [[bbdb:John][John (32nd)]]
`----

with a link to the bbdb entry that you can open with org-open-at-point
to get more information (e.g. an email address that you can send
birthday wishes to).

The bbdb entry for "John" is presented by bbdb like this:

John:
            net: john@foo.com
    anniversary: 1979-01-28 birthday
                 2009-02-28 wedding

and the entry in the bbdb database looks like this:

["John" nil nil nil nil ("john@foo.com") ((creation-date . "...") (timestamp . "...") (anniversary . "1979-01-22 birthday\n2009-02-28 wedding") ...) nil]

The only difficulty was how to enter multiple anniversaries into an entry
(as above): when you visit a bbdb entry, you create a new field with ``C-o''
called ``anniversary'' (bbdb knows about it and conveniently provides completion)
or edit the existing ``anniversary'' field with ``e''. The value is entered literally,
except that you have to quote any newlines, so you type:

   1979-01-28 <SP> birthday C-q C-j 2009-02-28 <SP> wedding <RET>

I added some spaces for readability above but you should *not* type any spaces
except those explicitly called out as <SP>.

HTH,
Nick

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

* Re: Using properties for diary-anniversaries
  2011-01-23 21:03 ` Nick Dokos
@ 2011-01-23 23:04   ` lecodesportif
  0 siblings, 0 replies; 12+ messages in thread
From: lecodesportif @ 2011-01-23 23:04 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

On Sun, 23 Jan 2011 16:03 -0500, "Nick Dokos" <nicholas.dokos@hp.com>
wrote:
> lecodesportif@eml.cc wrote:
> 
> > 
> > I have an anniversary list in Org Mode where entries have this format:
> > 
> > * John
> >   :PROPERTIES:
> >   :Name: John
> >   :Birthday: 5 4 1900
> >   :END:
> > 
> > I would like to add the "Birthday" and "Name" properties to Org Agenda
> > automatically. What I have so far is:
> > 
> > %%(apply 'diary-anniversary (read (org-entry-get nil "Birthday"))) John
> > 
> > When I enter this line right after the properties, the anniversary is
> > added at the correct date in the agenda. But I still have to enter the
> > name manually.
> > 
> > Is there a way to have the "Name" property added to the diary text
> > automatically? Can this be done for all entries in the list by adding
> > code at the top of the org file?
> 
> Not really an answer to your question - it's a different method that I
> find convenient. I use bbdb for contacts and so I prefer to add
> birthday/anniversary information to selected bbdb entries. Then one of
> the org files in my org-agenda-files includes the following entry:
> 
> --8<---------------cut here---------------start------------->8---
> #+CATEGORY: Anniv
> %%(org-bbdb-anniversaries)
> --8<---------------cut here---------------end--------------->8---
> 
> This causes entries in my agenda like this:
> 
> ,----
> | Friday     28 January 2011
> |   ...
> |   Anniv:      Birthday: [[bbdb:John][John (32nd)]]
> `----
> 
> with a link to the bbdb entry that you can open with org-open-at-point
> to get more information (e.g. an email address that you can send
> birthday wishes to).
> 
> The bbdb entry for "John" is presented by bbdb like this:
> 
> John:
>             net: john@foo.com
>     anniversary: 1979-01-28 birthday
>                  2009-02-28 wedding
> 
> and the entry in the bbdb database looks like this:
> 
> ["John" nil nil nil nil ("john@foo.com") ((creation-date . "...")
> (timestamp . "...") (anniversary . "1979-01-22 birthday\n2009-02-28
> wedding") ...) nil]
> 
> The only difficulty was how to enter multiple anniversaries into an entry
> (as above): when you visit a bbdb entry, you create a new field with
> ``C-o''
> called ``anniversary'' (bbdb knows about it and conveniently provides
> completion)
> or edit the existing ``anniversary'' field with ``e''. The value is
> entered literally,
> except that you have to quote any newlines, so you type:
> 
>    1979-01-28 <SP> birthday C-q C-j 2009-02-28 <SP> wedding <RET>
> 
> I added some spaces for readability above but you should *not* type any
> spaces
> except those explicitly called out as <SP>.

Thanks for the explanations. In fact I once had a look at BBDB but found
it too difficult to use. Then I decided to manage contacts using org
files only which is working well so far.

The anniversary list is part of that. I really hope to get an automatic
interaction between the properties and the agenda. If I give up on that,
I may have to use BBDB.

-- 
http://www.fastmail.fm - A no graphics, no pop-ups email service

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

* Re: Using properties for diary-anniversaries
  2011-01-23 14:36 Using properties for diary-anniversaries lecodesportif
  2011-01-23 21:03 ` Nick Dokos
@ 2011-01-24  1:16 ` Nick Dokos
  2011-01-24  8:27   ` lecodesportif
  1 sibling, 1 reply; 12+ messages in thread
From: Nick Dokos @ 2011-01-24  1:16 UTC (permalink / raw)
  To: lecodesportif; +Cc: nicholas.dokos, emacs-orgmode

lecodesportif@eml.cc wrote:

> I have an anniversary list in Org Mode where entries have this format:
> 
> * John
>   :PROPERTIES:
>   :Name: John
>   :Birthday: 5 4 1900
>   :END:
> 
> I would like to add the "Birthday" and "Name" properties to Org Agenda
> automatically. What I have so far is:
> 
> %%(apply 'diary-anniversary (read (org-entry-get nil "Birthday"))) John
> 
> When I enter this line right after the properties, the anniversary is
> added at the correct date in the agenda. But I still have to enter the
> name manually.
> 

Try something like this:

%%(apply 'diary-anniversary (mapcar 'string-to-number (split-string (org-entry-get nil "Birthday")))) John is %d years old

HTH,
Nick

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

* Re: Using properties for diary-anniversaries
  2011-01-24  1:16 ` Nick Dokos
@ 2011-01-24  8:27   ` lecodesportif
  2011-01-24 14:36     ` Nick Dokos
  0 siblings, 1 reply; 12+ messages in thread
From: lecodesportif @ 2011-01-24  8:27 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

On Sun, 23 Jan 2011 20:16 -0500, "Nick Dokos" <nicholas.dokos@hp.com>
wrote:
> lecodesportif@eml.cc wrote:
> 
> > I have an anniversary list in Org Mode where entries have this format:
> > 
> > * John
> >   :PROPERTIES:
> >   :Name: John
> >   :Birthday: 5 4 1900
> >   :END:
> > 
> > I would like to add the "Birthday" and "Name" properties to Org Agenda
> > automatically. What I have so far is:
> > 
> > %%(apply 'diary-anniversary (read (org-entry-get nil "Birthday"))) John
> > 
> > When I enter this line right after the properties, the anniversary is
> > added at the correct date in the agenda. But I still have to enter the
> > name manually.
> > 
> 
> Try something like this:
> 
> %%(apply 'diary-anniversary (mapcar 'string-to-number (split-string
> (org-entry-get nil "Birthday")))) John is %d years old

The %d was already working with my above code and the entry was
displayed at the correct date. What I am looking for is a way to get the
value of the name property ("John") automatically. That way I wouldn't
have to insert all names manually in the %%(apply... line following the
properties.

-- 
http://www.fastmail.fm - Accessible with your email software
                          or over the web

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

* Re: Using properties for diary-anniversaries
  2011-01-24  8:27   ` lecodesportif
@ 2011-01-24 14:36     ` Nick Dokos
  2011-01-24 20:46       ` Adam
  2011-01-25 13:17       ` lecodesportif
  0 siblings, 2 replies; 12+ messages in thread
From: Nick Dokos @ 2011-01-24 14:36 UTC (permalink / raw)
  To: lecodesportif; +Cc: Nick Dokos, emacs-orgmode

lecodesportif@eml.cc wrote:


> > > * John
> > >   :PROPERTIES:
> > >   :Name: John
> > >   :Birthday: 5 4 1900
> > >   :END:
> > > 
> > > I would like to add the "Birthday" and "Name" properties to Org Agenda
> > > automatically. What I have so far is:
> > > 
> > > %%(apply 'diary-anniversary (read (org-entry-get nil "Birthday"))) John
> > > 
> > > When I enter this line right after the properties, the anniversary is
> > > added at the correct date in the agenda. But I still have to enter the
> > > name manually.
> > > 
> > 
> > Try something like this:
> > 
> > %%(apply 'diary-anniversary (mapcar 'string-to-number (split-string
> > (org-entry-get nil "Birthday")))) John is %d years old
> 
> The %d was already working with my above code and the entry was
> displayed at the correct date. What I am looking for is a way to get the
> value of the name property ("John") automatically. That way I wouldn't
> have to insert all names manually in the %%(apply... line following the
> properties.
> 

Yes, sorry: I figured that I had answered the wrong question after I
sent it, but I was too tired to fix my mistake at that time. However, I
could not make your formulation work for me at all. I still don't
understand how it could possibly work: afaict, org-entry-get returns the
birthday as a string, "5 4 1900", the read returns the month as a
number, 5, and diary-anniversary should blow up because it needs at least two
arguments (a month and a day) - and it does in my case.

Be that as it may, re. filling in the name, I don't know how to do it
and I'm not sure that it can be done: the string after the function call
is scanned for %d but no other evaluation is done. org just passes the
string along and all of that work is done in diary-anniversary whose
doc string says:

,----
| The diary entry can contain `%d' or `%d%s'; the %d will be replaced
| by the number of years since the MONTH, DAY, YEAR, and the %s will
| be replaced by the ordinal ending of that number (that is, `st',
| `nd', `rd' or `th', as appropriate).  The anniversary of February 29
| is considered to be March 1 in non-leap years.
`----

So I think that's all you can do.

Nick

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

* Re: Using properties for diary-anniversaries
  2011-01-24 14:36     ` Nick Dokos
@ 2011-01-24 20:46       ` Adam
  2011-01-24 21:02         ` Nick Dokos
  2011-01-25 13:17       ` lecodesportif
  1 sibling, 1 reply; 12+ messages in thread
From: Adam @ 2011-01-24 20:46 UTC (permalink / raw)
  To: Emacs-orgmode

On Tuesday 25 January 2011 03:36 am, Nick Dokos wrote:
> lecodesportif@eml.cc wrote:
> > > > * John
> > > >
> > > >   :PROPERTIES:
> > > >   :Name: John
> > > >   :Birthday: 5 4 1900
> > > >   :END:
> > > >
> > > > I would like to add the "Birthday" and "Name" properties to Org
> > > > Agenda automatically. What I have so far is:
> > > >
> > > > %%(apply 'diary-anniversary (read (org-entry-get nil "Birthday")))
> > > > John
> > > >
> > > > When I enter this line right after the properties, the anniversary is
> > > > added at the correct date in the agenda. But I still have to enter
> > > > the name manually.
> > >
> > > Try something like this:
> > >
> > > %%(apply 'diary-anniversary (mapcar 'string-to-number (split-string
> > > (org-entry-get nil "Birthday")))) John is %d years old
> >
> > The %d was already working with my above code and the entry was
> > displayed at the correct date. What I am looking for is a way to get the
> > value of the name property ("John") automatically. That way I wouldn't
> > have to insert all names manually in the %%(apply... line following the
> > properties.
>
> Yes, sorry: I figured that I had answered the wrong question after I
> sent it, but I was too tired to fix my mistake at that time. However, I
> could not make your formulation work for me at all. I still don't
> understand how it could possibly work: afaict, org-entry-get returns the
> birthday as a string, "5 4 1900", the read returns the month as a
> number, 5, and diary-anniversary should blow up because it needs at least
> two arguments (a month and a day) - and it does in my case.
>
> Be that as it may, re. filling in the name, I don't know how to do it
> and I'm not sure that it can be done: the string after the function call
> is scanned for %d but no other evaluation is done. org just passes the
> string along and all of that work is done in diary-anniversary whose
> doc string says:
>
> ,----
>
> | The diary entry can contain `%d' or `%d%s'; the %d will be replaced
> | by the number of years since the MONTH, DAY, YEAR, and the %s will
> | be replaced by the ordinal ending of that number (that is, `st',
> | `nd', `rd' or `th', as appropriate).  The anniversary of February 29
> | is considered to be March 1 in non-leap years.
>
> `----
>
> So I think that's all you can do.
>
> Nick

Can I ask a more general question on this topic. Sort of, how 
we are using Emacs or Orgmode, for Anniversaries etc. 

So, there's a forthcoming Anniversary, say a birthday. And 
we want to be advised of this before that date.

Do we see it as a red highlighted Date, in Calendar, and then have 
to look at that highlighted date to see what's coming.  Or is it 
common to set up the anniversary / birthday to start appearing 
in a weekly or monthly Orgmode agenda ? Not as a Deadline, 
but as a Warning or Reminder. In which case regular Agendas 
are needed to be outputted. 

It would almost be nice if some forthcoming events were outputted 
to Messages, whenever Orgmode opened any org document. 
But I'm wondering how others flag forthcoming events, in Calendar 
or in Orgmode. 

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

* Re: Using properties for diary-anniversaries
  2011-01-24 20:46       ` Adam
@ 2011-01-24 21:02         ` Nick Dokos
  0 siblings, 0 replies; 12+ messages in thread
From: Nick Dokos @ 2011-01-24 21:02 UTC (permalink / raw)
  To: Adam; +Cc: nicholas.dokos, Emacs-orgmode

Adam <ahcnz@ihug.co.nz> wrote:

> Can I ask a more general question on this topic. Sort of, how 
> we are using Emacs or Orgmode, for Anniversaries etc. 
> 
> So, there's a forthcoming Anniversary, say a birthday. And 
> we want to be advised of this before that date.
> 

How do you want to be advised?

> Do we see it as a red highlighted Date, in Calendar, and then have 
> to look at that highlighted date to see what's coming.  Or is it 
> common to set up the anniversary / birthday to start appearing 
> in a weekly or monthly Orgmode agenda ? Not as a Deadline, 
> but as a Warning or Reminder. In which case regular Agendas 
> are needed to be outputted. 
> 

As I mentioned before, I use bbdb for contacts[fn:1] and the setup
described in sec. 10.3.1 of the Org manual for anniversaries. They then
appear in my agenda: since I use a 7-day span, I see them a week in
advance. See an earlier message in this thread for more details.
 

> It would almost be nice if some forthcoming events were outputted 
> to Messages, whenever Orgmode opened any org document. 

? Don't know what this means: the *Messages* buffer? or something
else?

> But I'm wondering how others flag forthcoming events, in Calendar 
> or in Orgmode. 
>

HTH,
Nick

Footnotes:
[fn:1] Julien Danjou is apparently working on a bbdb replacement that
he calls org-contacts, but it's still work-in-progress.

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

* Re: Using properties for diary-anniversaries
  2011-01-24 14:36     ` Nick Dokos
  2011-01-24 20:46       ` Adam
@ 2011-01-25 13:17       ` lecodesportif
  2011-01-25 14:53         ` Nick Dokos
  2011-01-25 15:05         ` Nick Dokos
  1 sibling, 2 replies; 12+ messages in thread
From: lecodesportif @ 2011-01-25 13:17 UTC (permalink / raw)
  Cc: Nick Dokos, emacs-orgmode

On Mon, 24 Jan 2011 09:36 -0500, "Nick Dokos" <nicholas.dokos@hp.com>
wrote:
> Yes, sorry: I figured that I had answered the wrong question after I
> sent it, but I was too tired to fix my mistake at that time. However, I
> could not make your formulation work for me at all. I still don't
> understand how it could possibly work: afaict, org-entry-get returns the
> birthday as a string, "5 4 1900", the read returns the month as a
> number, 5, and diary-anniversary should blow up because it needs at least
> two
> arguments (a month and a day) - and it does in my case.

You're probably right, there was a typo in my example. The below text is
corrected, I had forgotten the parantheses for the date!

* John
  :PROPERTIES:
  :Name: John
  :Birthday: (5 4 1900)
  :END:
  %%(apply 'diary-anniversary (read (org-entry-get nil "Birthday")))
  John

Does this work for you?

> Be that as it may, re. filling in the name, I don't know how to do it
> and I'm not sure that it can be done: the string after the function call
> is scanned for %d but no other evaluation is done. org just passes the
> string along and all of that work is done in diary-anniversary whose
> doc string says:
> 
> ,----
> | The diary entry can contain `%d' or `%d%s'; the %d will be replaced
> | by the number of years since the MONTH, DAY, YEAR, and the %s will
> | be replaced by the ordinal ending of that number (that is, `st',
> | `nd', `rd' or `th', as appropriate).  The anniversary of February 29
> | is considered to be March 1 in non-leap years.
> `----

Yes, it may require hacking diary-anniversary.

-- 
http://www.fastmail.fm - The professional email service

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

* Re: Using properties for diary-anniversaries
  2011-01-25 13:17       ` lecodesportif
@ 2011-01-25 14:53         ` Nick Dokos
  2011-01-25 15:05         ` Nick Dokos
  1 sibling, 0 replies; 12+ messages in thread
From: Nick Dokos @ 2011-01-25 14:53 UTC (permalink / raw)
  To: lecodesportif; +Cc: Nick Dokos, emacs-orgmode

lecodesportif@eml.cc wrote:

> On Mon, 24 Jan 2011 09:36 -0500, "Nick Dokos" <nicholas.dokos@hp.com>
> wrote:
> > Yes, sorry: I figured that I had answered the wrong question after I
> > sent it, but I was too tired to fix my mistake at that time. However, I
> > could not make your formulation work for me at all. I still don't
> > understand how it could possibly work: afaict, org-entry-get returns the
> > birthday as a string, "5 4 1900", the read returns the month as a
> > number, 5, and diary-anniversary should blow up because it needs at least
> > two
> > arguments (a month and a day) - and it does in my case.
> 
> You're probably right, there was a typo in my example. The below text is
> corrected, I had forgotten the parantheses for the date!
> 
> * John
>   :PROPERTIES:
>   :Name: John
>   :Birthday: (5 4 1900)
>   :END:
>   %%(apply 'diary-anniversary (read (org-entry-get nil "Birthday")))
>   John
> 
> Does this work for you?
> 

Yes it does, but having to remember to enter dates as lists in this
particular context does not feel right. It'd be OK if all dates were
entered as lists in org, but that's not the case. I'd rather parse a
more obvious representation.

> > Be that as it may, re. filling in the name, I don't know how to do it
> > and I'm not sure that it can be done: the string after the function call
> > is scanned for %d but no other evaluation is done. org just passes the
> > string along and all of that work is done in diary-anniversary whose
> > doc string says:
> > 
> > ,----
> > | The diary entry can contain `%d' or `%d%s'; the %d will be replaced
> > | by the number of years since the MONTH, DAY, YEAR, and the %s will
> > | be replaced by the ordinal ending of that number (that is, `st',
> > | `nd', `rd' or `th', as appropriate).  The anniversary of February 29
> > | is considered to be March 1 in non-leap years.
> > `----
> 
> Yes, it may require hacking diary-anniversary.
> 

Or perhaps investigate Julien Danjou's org-contacts (still work in
progress). Or give bbdb another chance...

Nick

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

* Re: Using properties for diary-anniversaries
  2011-01-25 13:17       ` lecodesportif
  2011-01-25 14:53         ` Nick Dokos
@ 2011-01-25 15:05         ` Nick Dokos
  2011-01-25 15:22           ` lecodesportif
  1 sibling, 1 reply; 12+ messages in thread
From: Nick Dokos @ 2011-01-25 15:05 UTC (permalink / raw)
  To: lecodesportif; +Cc: Nick Dokos, emacs-orgmode

lecodesportif@eml.cc wrote:


> Yes, it may require hacking diary-anniversary.
> 

One more thing before I turn into a pumpkin: what happens if you have
multiple entries (John's birthday, Mary's wedding anniversary, Jane's
birthday *and* her wedding anniversary, etc.) Are you expecting to deal
with all of them with a single diary sexp?  org-entry-get with a POM
argument of nil will only look around for the "nearest" entry (for some
definition of "nearest"). So it seems to me you are going to have one of
these sexps after each and every entry (and you may have to add an
"Anniversary" property as well and search for that in addition to
"Birthday"). But then why would you need an automatic way to fill in the
name?  You can just add a person-specific string to each person-specific
diary sexp and be done with it. For example,

--8<---------------cut here---------------start------------->8---
* John
  :PROPERTIES:
  :Name: John
  :Birthday: (5 4 1900)
  :END:

%%(apply 'diary-anniversary (read (org-entry-get nil "Birthday"))) John

* Jane
  :PROPERTIES:
  :Name: Jane
  :Birthday: (5 4 1901)
  :END:

%%(apply 'diary-anniversary (read (org-entry-get nil "Birthday"))) Jane
--8<---------------cut here---------------end--------------->8---

Nick

PS. BTW, I believe the %% has to be flush left: you cannot indent it. At
least the manual says so.

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

* Re: Using properties for diary-anniversaries
  2011-01-25 15:05         ` Nick Dokos
@ 2011-01-25 15:22           ` lecodesportif
  0 siblings, 0 replies; 12+ messages in thread
From: lecodesportif @ 2011-01-25 15:22 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

On Tue, 25 Jan 2011 10:05 -0500, "Nick Dokos" <nicholas.dokos@hp.com>
wrote:
> lecodesportif@eml.cc wrote:
> 
> 
> > Yes, it may require hacking diary-anniversary.
> > 
> 
> One more thing before I turn into a pumpkin: what happens if you have
> multiple entries (John's birthday, Mary's wedding anniversary, Jane's
> birthday *and* her wedding anniversary, etc.) Are you expecting to deal
> with all of them with a single diary sexp?  org-entry-get with a POM
> argument of nil will only look around for the "nearest" entry (for some
> definition of "nearest"). So it seems to me you are going to have one of
> these sexps after each and every entry (and you may have to add an
> "Anniversary" property as well and search for that in addition to
> "Birthday"). But then why would you need an automatic way to fill in the
> name?  You can just add a person-specific string to each person-specific
> diary sexp and be done with it. For example,
> 
> --8<---------------cut here---------------start------------->8---
> * John
>   :PROPERTIES:
>   :Name: John
>   :Birthday: (5 4 1900)
>   :END:
> 
> %%(apply 'diary-anniversary (read (org-entry-get nil "Birthday"))) John
> 
> * Jane
>   :PROPERTIES:
>   :Name: Jane
>   :Birthday: (5 4 1901)
>   :END:
> 
> %%(apply 'diary-anniversary (read (org-entry-get nil "Birthday"))) Jane
> --8<---------------cut here---------------end--------------->8---

I'm using it this way right now. An automatic way to fill in the names
would help if the file had many entries. A single sexp for the whole
file would be even more convenient.

> PS. BTW, I believe the %% has to be flush left: you cannot indent it. At
> least the manual says so.

It's working with this indentation:

* Jane
   :PROPERTIES:
   :Name: Jane
   :Birthday: (5 4 1901)
   :END:
   %%(apply 'diary-anniversary (read (org-entry-get nil "Birthday")))
   Jane

-- 
http://www.fastmail.fm - Access your email from home and the web

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

end of thread, other threads:[~2011-01-25 15:22 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-23 14:36 Using properties for diary-anniversaries lecodesportif
2011-01-23 21:03 ` Nick Dokos
2011-01-23 23:04   ` lecodesportif
2011-01-24  1:16 ` Nick Dokos
2011-01-24  8:27   ` lecodesportif
2011-01-24 14:36     ` Nick Dokos
2011-01-24 20:46       ` Adam
2011-01-24 21:02         ` Nick Dokos
2011-01-25 13:17       ` lecodesportif
2011-01-25 14:53         ` Nick Dokos
2011-01-25 15:05         ` Nick Dokos
2011-01-25 15:22           ` lecodesportif

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