Sexp diary entries may retrurn a list
commit47107b661224e696611a2bb7cbab3204444403e0
authorŁukasz Stelmach <lukasz.stelmach@iem.pw.edu.pl>
Sun, 24 Oct 2010 20:01:47 +0000 (24 22:01 +0200)
committerCarsten Dominik <carsten.dominik@gmail.com>
Tue, 26 Oct 2010 05:27:19 +0000 (26 07:27 +0200)
treeaa235386dc10e3875cacee2b24d8f9edd04393a8
parent3ffb50b0b7dc092a8d718e06ad0843100d82078b
Sexp diary entries may retrurn a list

* lisp/org-agenda.el (org-agenda-get-sexps): Handle lists as return values
from diary entries
* lisp/org-bbdb.el (org-bbdb-anniversaries): Handle lists of anniversaries
* lisp/org.el (org-diary-sexp-entry): Handle lists as return values
from diary entries.

 ukasz Stelmach <lukasz.stelmach@iem.pw.edu.pl> writes:

> I've disovered, that %%(org-bbdb-anniversaries) returns (as every other
> sexp) a string. Which is OK if there is only one.
>
>   Anniversaries:  John Doe's 10th wedding anniversary
>
> Unfortunately the agenda view becomes awful if we have noted Jane's
> weeding date too
>
>   Anniversaries:  John Doe's 10th wedding anniversary; Jane Doe's 10th wedding anniversary
>
> And what if we know 3 Eves and 5 Adams and it's Christmas Eve? (Hint:
> their name day)
[...]

As Thomas Bauman pointed out, there are functions that can be used in
sexps which return cons cells like this

    (nil . "Full Moon 3:35am (CEST)")

(this one is diary-lunar-phases), these aren't properly supported by the
previous version of my patch. This one can distinguish between such a
cons cell and a "real" list.

    ("John Doe's 10th wedding anniversary"
     "Jane Doe's 10th wedding anniversary")

This is because

    (consp (cdr '(a . b))) ; => nil

so org-diary-sexp-entry can be made return (cdr result) only in case of
the former cons cell. The third condition in the `cond' block is IMHO
enough as it is now, but if you think adding

    (listp (cdr result))

may help then be it.
lisp/org-agenda.el
lisp/org-bbdb.el
lisp/org.el