summaryrefslogtreecommitdiff
path: root/lisp/org/org-bbdb.el
diff options
context:
space:
mode:
authorBastien Guerry <bastien1@free.fr>2011-07-28 17:13:49 +0200
committerBastien Guerry <bastien1@free.fr>2011-07-28 17:13:49 +0200
commit3ab2c837b302b01fff610f7b83050ab7e703477c (patch)
treeefa67ed523bbda4d41488ae6b9ad2782941ddcf2 /lisp/org/org-bbdb.el
parent44a8054f971837447e80d618b6e0c2a77778a2ee (diff)
downloademacs-3ab2c837b302b01fff610f7b83050ab7e703477c.tar.gz
Merge changes from Org 7.4 to current Org 7.7.
Diffstat (limited to 'lisp/org/org-bbdb.el')
-rw-r--r--lisp/org/org-bbdb.el41
1 files changed, 27 insertions, 14 deletions
diff --git a/lisp/org/org-bbdb.el b/lisp/org/org-bbdb.el
index 49393db4304..b405718a49a 100644
--- a/lisp/org/org-bbdb.el
+++ b/lisp/org/org-bbdb.el
@@ -1,12 +1,13 @@
;;; org-bbdb.el --- Support for links to BBDB entries from within Org-mode
-;; Copyright (C) 2004-2011 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
+;; Free Software Foundation, Inc.
;; Author: Carsten Dominik <carsten at orgmode dot org>,
;; Thomas Baumann <thomas dot baumann at ch dot tum dot de>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 7.4
+;; Version: 7.7
;;
;; This file is part of GNU Emacs.
;;
@@ -135,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
@@ -207,10 +208,12 @@ date year)."
"Create the export version of a BBDB link specified by PATH or DESC.
If exporting to either HTML or LaTeX FORMAT the link will be
italicized, in all other cases it is left unchanged."
+ (when (string= desc (format "bbdb:%s" path))
+ (setq desc path))
(cond
- ((eq format 'html) (format "<i>%s</i>" (or desc path)))
- ((eq format 'latex) (format "\\textit{%s}" (or desc path)))
- (t (or desc path))))
+ ((eq format 'html) (format "<i>%s</i>" desc))
+ ((eq format 'latex) (format "\\textit{%s}" desc))
+ (t desc)))
(defun org-bbdb-open (name)
"Follow a BBDB link to NAME."
@@ -238,11 +241,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.
@@ -325,8 +333,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))
@@ -380,5 +392,6 @@ END:VEVENT\n"
(provide 'org-bbdb)
+;; arch-tag: 9e4f275d-d080-48c1-b040-62247f66b5c2
;;; org-bbdb.el ends here