emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: lecodesportif@eml.cc
Cc: Nick Dokos <nicholas.dokos@hp.com>, emacs-orgmode@gnu.org
Subject: Re: Using properties for diary-anniversaries
Date: Mon, 24 Jan 2011 09:36:58 -0500	[thread overview]
Message-ID: <26027.1295879818@gamaville.dokosmarshall.org> (raw)
In-Reply-To: Message from lecodesportif@eml.cc of "Mon, 24 Jan 2011 00:27:54 PST." <1295857674.26398.1416871253@webmail.messagingengine.com>

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

  reply	other threads:[~2011-01-24 14:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26027.1295879818@gamaville.dokosmarshall.org \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=lecodesportif@eml.cc \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).