From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Subject: Re: Using properties for diary-anniversaries Date: Tue, 25 Jan 2011 09:46:17 +1300 Message-ID: <201101250946.18308.ahcnz@ihug.co.nz> References: <1295793360.20637.1416756473@webmail.messagingengine.com> <1295857674.26398.1416871253@webmail.messagingengine.com> <26027.1295879818@gamaville.dokosmarshall.org> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=42853 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhTEI-00055h-Qo for Emacs-orgmode@gnu.org; Mon, 24 Jan 2011 15:41:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PhTEH-0001jJ-DI for Emacs-orgmode@gnu.org; Mon, 24 Jan 2011 15:41:38 -0500 Received: from mailfilter3.ihug.co.nz ([203.109.136.3]:50452 helo=mailfilter67.ihug.co.nz) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PhTEH-0001hc-4u for Emacs-orgmode@gnu.org; Mon, 24 Jan 2011 15:41:37 -0500 In-Reply-To: <26027.1295879818@gamaville.dokosmarshall.org> Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Emacs-orgmode@gnu.org 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.