* org-bbdb: anniversaries with unknown years @ 2010-10-10 10:15 Christoph Groth 2010-10-10 10:34 ` Carsten Dominik 0 siblings, 1 reply; 11+ messages in thread From: Christoph Groth @ 2010-10-10 10:15 UTC (permalink / raw) To: emacs-orgmode Hello, I'd like to keep birthdays and similar dates in bbdb and have them shown in my org mode agenda views. Often, however, I do not know the year of an anniversary, and in the case of my acquaintances the year of a personal anniversary is often not meaningful (e.g. name days, popular in some countries). The solution that came to my mind was to update org-bbdg.el to also accept dates in the format MM-DD. org-bbdb-anniv-extract-date would then substitute nil for unknown years. The remaining code would make sure that "unknown" is substituted for unknown `years'. That solution seems fine, however it would break compatibility with the old format of org-bbdb-anniversary-format-alist, as this assumes that a numerical value of `years' is always defined. Before writing a patch, I would like to ask for opinions on this. Cheers Christoph ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: org-bbdb: anniversaries with unknown years 2010-10-10 10:15 org-bbdb: anniversaries with unknown years Christoph Groth @ 2010-10-10 10:34 ` Carsten Dominik 2010-10-10 11:16 ` Richard Riley 2011-02-07 11:43 ` [PATCH] org-bbdb: allow " Christoph Groth 0 siblings, 2 replies; 11+ messages in thread From: Carsten Dominik @ 2010-10-10 10:34 UTC (permalink / raw) To: Christoph Groth; +Cc: emacs-orgmode On Oct 10, 2010, at 12:15 PM, Christoph Groth wrote: > Hello, > > I'd like to keep birthdays and similar dates in bbdb and have them > shown > in my org mode agenda views. Often, however, I do not know the year > of > an anniversary, and in the case of my acquaintances the year of a > personal anniversary is often not meaningful (e.g. name days, > popular in > some countries). > > The solution that came to my mind was to update org-bbdg.el to also > accept dates in the format MM-DD. org-bbdb-anniv-extract-date would > then substitute nil for unknown years. The remaining code would make > sure that "unknown" is substituted for unknown `years'. > > That solution seems fine, however it would break compatibility with > the > old format of org-bbdb-anniversary-format-alist, as this assumes > that a > numerical value of `years' is always defined. > > Before writing a patch, I would like to ask for opinions on this. I am not sure if there are nay other tools which make use of birthdays in bbdb. I would such an extension useful. - Carsten > > Cheers > Christoph > > > _______________________________________________ > 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] 11+ messages in thread
* Re: org-bbdb: anniversaries with unknown years 2010-10-10 10:34 ` Carsten Dominik @ 2010-10-10 11:16 ` Richard Riley 2010-10-10 11:26 ` Carsten Dominik 2011-02-07 11:43 ` [PATCH] org-bbdb: allow " Christoph Groth 1 sibling, 1 reply; 11+ messages in thread From: Richard Riley @ 2010-10-10 11:16 UTC (permalink / raw) To: emacs-orgmode Carsten Dominik <carsten.dominik@gmail.com> writes: > On Oct 10, 2010, at 12:15 PM, Christoph Groth wrote: > >> Hello, >> >> I'd like to keep birthdays and similar dates in bbdb and have them >> shown >> in my org mode agenda views. Often, however, I do not know the year >> of >> an anniversary, and in the case of my acquaintances the year of a >> personal anniversary is often not meaningful (e.g. name days, >> popular in >> some countries). >> >> The solution that came to my mind was to update org-bbdg.el to also >> accept dates in the format MM-DD. org-bbdb-anniv-extract-date would >> then substitute nil for unknown years. The remaining code would make >> sure that "unknown" is substituted for unknown `years'. >> >> That solution seems fine, however it would break compatibility with >> the >> old format of org-bbdb-anniversary-format-alist, as this assumes >> that a >> numerical value of `years' is always defined. >> >> Before writing a patch, I would like to ask for opinions on this. > > I am not sure if there are nay other tools which make use of birthdays > in bbdb. > > I would such an extension useful. > > - Carsten ++ on that one. I get funny looks when asking friends what year they were born in. Not least because I refuse to capitulate to the FaceBook masses. org-mode might be referred to, jokingly, as Borg-mode in #emacs but faceBook is a far more powerful force for evil ..... ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Re: org-bbdb: anniversaries with unknown years 2010-10-10 11:16 ` Richard Riley @ 2010-10-10 11:26 ` Carsten Dominik 2010-10-10 11:57 ` Richard Riley 0 siblings, 1 reply; 11+ messages in thread From: Carsten Dominik @ 2010-10-10 11:26 UTC (permalink / raw) To: Richard Riley; +Cc: emacs-orgmode On Oct 10, 2010, at 1:16 PM, Richard Riley wrote: > Carsten Dominik <carsten.dominik@gmail.com> writes: > >> On Oct 10, 2010, at 12:15 PM, Christoph Groth wrote: >> >>> Hello, >>> >>> I'd like to keep birthdays and similar dates in bbdb and have them >>> shown >>> in my org mode agenda views. Often, however, I do not know the year >>> of >>> an anniversary, and in the case of my acquaintances the year of a >>> personal anniversary is often not meaningful (e.g. name days, >>> popular in >>> some countries). >>> >>> The solution that came to my mind was to update org-bbdg.el to also >>> accept dates in the format MM-DD. org-bbdb-anniv-extract-date would >>> then substitute nil for unknown years. The remaining code would >>> make >>> sure that "unknown" is substituted for unknown `years'. >>> >>> That solution seems fine, however it would break compatibility with >>> the >>> old format of org-bbdb-anniversary-format-alist, as this assumes >>> that a >>> numerical value of `years' is always defined. >>> >>> Before writing a patch, I would like to ask for opinions on this. >> >> I am not sure if there are nay other tools which make use of >> birthdays >> in bbdb. >> >> I would such an extension useful. >> >> - Carsten > > > ++ on that one. I get funny looks when asking friends what year they > were born in. Not least because I refuse to capitulate to the FaceBook > masses. org-mode might be referred to, jokingly, as Borg-mode in > #emacs :-) Is that so??? ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Re: org-bbdb: anniversaries with unknown years 2010-10-10 11:26 ` Carsten Dominik @ 2010-10-10 11:57 ` Richard Riley 2010-10-25 16:33 ` Thomas Baumann 0 siblings, 1 reply; 11+ messages in thread From: Richard Riley @ 2010-10-10 11:57 UTC (permalink / raw) To: Carsten Dominik; +Cc: Richard Riley, emacs-orgmode Carsten Dominik <carsten.dominik@gmail.com> writes: > On Oct 10, 2010, at 1:16 PM, Richard Riley wrote: > >> >> ++ on that one. I get funny looks when asking friends what year they >> were born in. Not least because I refuse to capitulate to the FaceBook >> masses. org-mode might be referred to, jokingly, as Borg-mode in >> #emacs > > :-) Is that so??? > > I think it's somewhat witty ;) Since org-mode has a contrib for just about everything except making the morning coffee (uh oh ...) ;) It (org-mode) has even been mentioned in Xah Lee's latest contribution to the emacs help group as a possible replacement for the antiquated texinfo formats required for info files ... ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: org-bbdb: anniversaries with unknown years 2010-10-10 11:57 ` Richard Riley @ 2010-10-25 16:33 ` Thomas Baumann 0 siblings, 0 replies; 11+ messages in thread From: Thomas Baumann @ 2010-10-25 16:33 UTC (permalink / raw) To: emacs-orgmode I will look into that. Thomas ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] org-bbdb: allow anniversaries with unknown years 2010-10-10 10:34 ` Carsten Dominik 2010-10-10 11:16 ` Richard Riley @ 2011-02-07 11:43 ` Christoph Groth 2011-02-08 15:57 ` [Accepted] " Bastien Guerry ` (2 more replies) 1 sibling, 3 replies; 11+ messages in thread From: Christoph Groth @ 2011-02-07 11:43 UTC (permalink / raw) To: emacs-orgmode; +Cc: Christoph Groth Anniversaries in BBDB can be now also specified in the format MM-DD next to YYYY-MM-DD. --- doc/org.texi | 11 ++++++----- lisp/org-bbdb.el | 27 ++++++++++++++++++--------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index b406d29..bfcef06 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -7098,14 +7098,15 @@ following to one your your agenda files: You can then go ahead and define anniversaries for a BBDB record. Basically, you need to press @kbd{C-o anniversary @key{RET}} with the cursor in a BBDB -record and then add the date in the format @code{YYYY-MM-DD}, followed by a -space and the class of the anniversary (@samp{birthday} or @samp{wedding}, or -a format string). If you omit the class, it will default to @samp{birthday}. -Here are a few examples, the header for the file @file{org-bbdb.el} contains -more detailed information. +record and then add the date in the format @code{YYYY-MM-DD} or @code{MM-DD}, +followed by a space and the class of the anniversary (@samp{birthday} or +@samp{wedding}, or a format string). If you omit the class, it will default to +@samp{birthday}. Here are a few examples, the header for the file +@file{org-bbdb.el} contains more detailed information. @example 1973-06-22 +06-22 1955-08-02 wedding 2008-04-14 %s released version 6.01 of org-mode, %d years ago @end example diff --git a/lisp/org-bbdb.el b/lisp/org-bbdb.el index 4155f58..c04b7ff 100644 --- a/lisp/org-bbdb.el +++ b/lisp/org-bbdb.el @@ -136,12 +136,12 @@ '(("birthday" lambda (name years suffix) (concat "Birthday: [[bbdb:" name "][" name " (" - (number-to-string years) + (format "%s" years) ; handles numbers as well as strings suffix ")]]")) ("wedding" lambda (name years suffix) (concat "[[bbdb:" name "][" name "'s " - (number-to-string years) + (format "%s" years) suffix " wedding anniversary]]"))) "How different types of anniversaries should be formatted. An alist of elements (STRING . FORMAT) where STRING is the name of an @@ -239,11 +239,16 @@ italicized, in all other cases it is left unchanged." (defun org-bbdb-anniv-extract-date (time-str) "Convert YYYY-MM-DD to (month date year). -Argument TIME-STR is the value retrieved from BBDB." - (multiple-value-bind (y m d) (values-list (bbdb-split time-str "-")) - (list (string-to-number m) - (string-to-number d) - (string-to-number y)))) +Argument TIME-STR is the value retrieved from BBDB. If YYYY- is omitted +it will be considered unknown." + (multiple-value-bind (a b c) (values-list (bbdb-split time-str "-")) + (if (eq c nil) + (list (string-to-number a) + (string-to-number b) + nil) + (list (string-to-number b) + (string-to-number c) + (string-to-number a))))) (defun org-bbdb-anniv-split (str) "Split multiple entries in the BBDB anniversary field. @@ -326,8 +331,12 @@ This is used by Org to re-create the anniversary hash table." class org-bbdb-anniversary-format-alist t)) class)) ; (as format string) (name (nth 1 rec)) - (years (- y (car rec))) - (suffix (diary-ordinal-suffix years)) + (years (if (eq (car rec) nil) + "unknown" + (- y (car rec)))) + (suffix (if (eq (car rec) nil) + "" + (diary-ordinal-suffix years))) (tmp (cond ((functionp form) (funcall form name years suffix)) -- 1.7.2.3 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Accepted] org-bbdb: allow anniversaries with unknown years 2011-02-07 11:43 ` [PATCH] org-bbdb: allow " Christoph Groth @ 2011-02-08 15:57 ` Bastien Guerry 2011-02-08 15:58 ` [PATCH] " Bastien 2011-02-08 16:05 ` Thomas Baumann 2 siblings, 0 replies; 11+ messages in thread From: Bastien Guerry @ 2011-02-08 15:57 UTC (permalink / raw) To: emacs-orgmode Patch 585 (http://patchwork.newartisans.com/patch/585/) is now "Accepted". Maintainer comment: none This relates to the following submission: http://mid.gmane.org/%3C1297078995-9030-1-git-send-email-cwg%40falma.de%3E Here is the original message containing the patch: > Content-Type: text/plain; charset="utf-8" > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit > Subject: [Orgmode] org-bbdb: allow anniversaries with unknown years > Date: Mon, 07 Feb 2011 16:43:15 -0000 > From: Christoph Groth <cwg@falma.de> > X-Patchwork-Id: 585 > Message-Id: <1297078995-9030-1-git-send-email-cwg@falma.de> > To: emacs-orgmode@gnu.org > Cc: Christoph Groth <cwg@falma.de> > > Anniversaries in BBDB can be now also specified in the format MM-DD > next to YYYY-MM-DD. > > --- > doc/org.texi | 11 ++++++----- > lisp/org-bbdb.el | 27 ++++++++++++++++++--------- > 2 files changed, 24 insertions(+), 14 deletions(-) > > diff --git a/doc/org.texi b/doc/org.texi > index b406d29..bfcef06 100644 > --- a/doc/org.texi > +++ b/doc/org.texi > @@ -7098,14 +7098,15 @@ following to one your your agenda files: > > You can then go ahead and define anniversaries for a BBDB record. Basically, > you need to press @kbd{C-o anniversary @key{RET}} with the cursor in a BBDB > -record and then add the date in the format @code{YYYY-MM-DD}, followed by a > -space and the class of the anniversary (@samp{birthday} or @samp{wedding}, or > -a format string). If you omit the class, it will default to @samp{birthday}. > -Here are a few examples, the header for the file @file{org-bbdb.el} contains > -more detailed information. > +record and then add the date in the format @code{YYYY-MM-DD} or @code{MM-DD}, > +followed by a space and the class of the anniversary (@samp{birthday} or > +@samp{wedding}, or a format string). If you omit the class, it will default to > +@samp{birthday}. Here are a few examples, the header for the file > +@file{org-bbdb.el} contains more detailed information. > > @example > 1973-06-22 > +06-22 > 1955-08-02 wedding > 2008-04-14 %s released version 6.01 of org-mode, %d years ago > @end example > diff --git a/lisp/org-bbdb.el b/lisp/org-bbdb.el > index 4155f58..c04b7ff 100644 > --- a/lisp/org-bbdb.el > +++ b/lisp/org-bbdb.el > @@ -136,12 +136,12 @@ > '(("birthday" lambda > (name years suffix) > (concat "Birthday: [[bbdb:" name "][" name " (" > - (number-to-string years) > + (format "%s" years) ; handles numbers as well as strings > suffix ")]]")) > ("wedding" lambda > (name years suffix) > (concat "[[bbdb:" name "][" name "'s " > - (number-to-string years) > + (format "%s" years) > suffix " wedding anniversary]]"))) > "How different types of anniversaries should be formatted. > An alist of elements (STRING . FORMAT) where STRING is the name of an > @@ -239,11 +239,16 @@ italicized, in all other cases it is left unchanged." > > (defun org-bbdb-anniv-extract-date (time-str) > "Convert YYYY-MM-DD to (month date year). > -Argument TIME-STR is the value retrieved from BBDB." > - (multiple-value-bind (y m d) (values-list (bbdb-split time-str "-")) > - (list (string-to-number m) > - (string-to-number d) > - (string-to-number y)))) > +Argument TIME-STR is the value retrieved from BBDB. If YYYY- is omitted > +it will be considered unknown." > + (multiple-value-bind (a b c) (values-list (bbdb-split time-str "-")) > + (if (eq c nil) > + (list (string-to-number a) > + (string-to-number b) > + nil) > + (list (string-to-number b) > + (string-to-number c) > + (string-to-number a))))) > > (defun org-bbdb-anniv-split (str) > "Split multiple entries in the BBDB anniversary field. > @@ -326,8 +331,12 @@ This is used by Org to re-create the anniversary hash table." > class org-bbdb-anniversary-format-alist t)) > class)) ; (as format string) > (name (nth 1 rec)) > - (years (- y (car rec))) > - (suffix (diary-ordinal-suffix years)) > + (years (if (eq (car rec) nil) > + "unknown" > + (- y (car rec)))) > + (suffix (if (eq (car rec) nil) > + "" > + (diary-ordinal-suffix years))) > (tmp (cond > ((functionp form) > (funcall form name years suffix)) > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] org-bbdb: allow anniversaries with unknown years 2011-02-07 11:43 ` [PATCH] org-bbdb: allow " Christoph Groth 2011-02-08 15:57 ` [Accepted] " Bastien Guerry @ 2011-02-08 15:58 ` Bastien 2011-02-08 16:05 ` Thomas Baumann 2 siblings, 0 replies; 11+ messages in thread From: Bastien @ 2011-02-08 15:58 UTC (permalink / raw) To: Christoph Groth; +Cc: emacs-orgmode Christoph Groth <cwg@falma.de> writes: > Anniversaries in BBDB can be now also specified in the format MM-DD > next to YYYY-MM-DD. I've now applied this patch, thanks for it! -- Bastien ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] org-bbdb: allow anniversaries with unknown years 2011-02-07 11:43 ` [PATCH] org-bbdb: allow " Christoph Groth 2011-02-08 15:57 ` [Accepted] " Bastien Guerry 2011-02-08 15:58 ` [PATCH] " Bastien @ 2011-02-08 16:05 ` Thomas Baumann 2011-02-09 14:42 ` Christoph Groth 2 siblings, 1 reply; 11+ messages in thread From: Thomas Baumann @ 2011-02-08 16:05 UTC (permalink / raw) To: emacs-orgmode; +Cc: Carsten Dominik Christoph Groth <cwg@falma.de> writes: > Anniversaries in BBDB can be now also specified in the format MM-DD > next to YYYY-MM-DD. > --- > doc/org.texi | 11 ++++++----- > lisp/org-bbdb.el | 27 ++++++++++++++++++--------- > 2 files changed, 24 insertions(+), 14 deletions(-) > > diff --git a/doc/org.texi b/doc/org.texi > index b406d29..bfcef06 100644 > --- a/doc/org.texi > +++ b/doc/org.texi > @@ -7098,14 +7098,15 @@ following to one your your agenda files: > > You can then go ahead and define anniversaries for a BBDB record. Basically, > you need to press @kbd{C-o anniversary @key{RET}} with the cursor in a BBDB > -record and then add the date in the format @code{YYYY-MM-DD}, followed by a > -space and the class of the anniversary (@samp{birthday} or @samp{wedding}, or > -a format string). If you omit the class, it will default to @samp{birthday}. > -Here are a few examples, the header for the file @file{org-bbdb.el} contains > -more detailed information. > +record and then add the date in the format @code{YYYY-MM-DD} or @code{MM-DD}, > +followed by a space and the class of the anniversary (@samp{birthday} or > +@samp{wedding}, or a format string). If you omit the class, it will default to > +@samp{birthday}. Here are a few examples, the header for the file > +@file{org-bbdb.el} contains more detailed information. > > @example > 1973-06-22 > +06-22 > 1955-08-02 wedding > 2008-04-14 %s released version 6.01 of org-mode, %d years ago > @end example > diff --git a/lisp/org-bbdb.el b/lisp/org-bbdb.el > index 4155f58..c04b7ff 100644 > --- a/lisp/org-bbdb.el > +++ b/lisp/org-bbdb.el > @@ -136,12 +136,12 @@ > '(("birthday" lambda > (name years suffix) > (concat "Birthday: [[bbdb:" name "][" name " (" > - (number-to-string years) > + (format "%s" years) ; handles numbers as well as strings > suffix ")]]")) > ("wedding" lambda > (name years suffix) > (concat "[[bbdb:" name "][" name "'s " > - (number-to-string years) > + (format "%s" years) > suffix " wedding anniversary]]"))) > "How different types of anniversaries should be formatted. > An alist of elements (STRING . FORMAT) where STRING is the name of an > @@ -239,11 +239,16 @@ italicized, in all other cases it is left unchanged." > > (defun org-bbdb-anniv-extract-date (time-str) > "Convert YYYY-MM-DD to (month date year). > -Argument TIME-STR is the value retrieved from BBDB." > - (multiple-value-bind (y m d) (values-list (bbdb-split time-str "-")) > - (list (string-to-number m) > - (string-to-number d) > - (string-to-number y)))) > +Argument TIME-STR is the value retrieved from BBDB. If YYYY- is omitted > +it will be considered unknown." > + (multiple-value-bind (a b c) (values-list (bbdb-split time-str "-")) > + (if (eq c nil) > + (list (string-to-number a) > + (string-to-number b) > + nil) > + (list (string-to-number b) > + (string-to-number c) > + (string-to-number a))))) > > (defun org-bbdb-anniv-split (str) > "Split multiple entries in the BBDB anniversary field. > @@ -326,8 +331,12 @@ This is used by Org to re-create the anniversary hash table." > class org-bbdb-anniversary-format-alist t)) > class)) ; (as format string) > (name (nth 1 rec)) > - (years (- y (car rec))) > - (suffix (diary-ordinal-suffix years)) > + (years (if (eq (car rec) nil) > + "unknown" > + (- y (car rec)))) > + (suffix (if (eq (car rec) nil) > + "" > + (diary-ordinal-suffix years))) > (tmp (cond > ((functionp form) > (funcall form name years suffix)) Thanks for adding this feature. Carsten, could you please check this in? The ChangeLog should mention that any customized "org-bbdb-anniversary-format-alist" has to be updated, otherwise there will be an "Bad sexp at line 637 in /home/tb/org/diary.org: (org-bbdb-anniversaries)" error with the new format. Thomas ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] org-bbdb: allow anniversaries with unknown years 2011-02-08 16:05 ` Thomas Baumann @ 2011-02-09 14:42 ` Christoph Groth 0 siblings, 0 replies; 11+ messages in thread From: Christoph Groth @ 2011-02-09 14:42 UTC (permalink / raw) To: emacs-orgmode Thomas Baumann <dtbaumann@yahoo.de> writes: > Christoph Groth <cwg@falma.de> writes: > >> Anniversaries in BBDB can be now also specified in the format MM-DD >> next to YYYY-MM-DD. > The ChangeLog should mention that any customized > "org-bbdb-anniversary-format-alist" has to be updated, otherwise there > will be an "Bad sexp at line 637 in /home/tb/org/diary.org: > (org-bbdb-anniversaries)" error with the new format. Yes, this patch breaks compatibility, so this should be documented in the proper place. I didn't as I'm not sure about the policies of orgmode here. Christoph ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-02-09 17:07 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-10-10 10:15 org-bbdb: anniversaries with unknown years Christoph Groth 2010-10-10 10:34 ` Carsten Dominik 2010-10-10 11:16 ` Richard Riley 2010-10-10 11:26 ` Carsten Dominik 2010-10-10 11:57 ` Richard Riley 2010-10-25 16:33 ` Thomas Baumann 2011-02-07 11:43 ` [PATCH] org-bbdb: allow " Christoph Groth 2011-02-08 15:57 ` [Accepted] " Bastien Guerry 2011-02-08 15:58 ` [PATCH] " Bastien 2011-02-08 16:05 ` Thomas Baumann 2011-02-09 14:42 ` Christoph Groth
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).