Jelajahi Sumber

BBDB/iCal anniversaries: Use user-defined format

Carsten Dominik 16 tahun lalu
induk
melakukan
48bdf22482
1 mengubah file dengan 12 tambahan dan 12 penghapusan
  1. 12 12
      lisp/org-bbdb.el

+ 12 - 12
lisp/org-bbdb.el

@@ -362,24 +362,24 @@ This is used by Org to re-create the anniversary hash table."
 (defun org-bbdb-format-vevent (key recs)
   (let (rec categ)
     (while (setq rec (pop recs))
+      (setq categ (or (nth 2 rec) org-bbdb-default-anniversary-format))
       (princ (format "BEGIN:VEVENT
 UID: ANNIV-%4i%02i%02i-%s
 DTSTART:%4i%02i%02i
-SUMMARY:%s\n"
-		     (nth 0 rec)
-		     (nth 0 key)
-		     (nth 1 key)
+SUMMARY:%s
+DESCRIPTION:%s
+CATEGORIES:%s
+RRULE:FREQ=YEARLY
+END:VEVENT\n"
+		     (nth 0 rec) (nth 0 key) (nth 1 key)
 		     (mapconcat 'identity
 				(org-split-string (nth 1 rec) "[^a-zA-Z0-90]+")
 				"-")
-		     (nth 0 rec)
-		     (nth 0 key)
-		     (nth 1 key)
-		     (nth 1 rec)))
-      (if (setq categ (nth 2 rec))
-	  (princ (format "CATEGORIES:%s\n" (upcase categ))))
-      (princ "RRULE:FREQ=YEARLY
-END:VEVENT\n"))))
+		     (nth 0 rec) (nth 0 key) (nth 1 key)
+		     (nth 1 rec) 
+		     (concat (capitalize categ) " " (nth 1 rec))
+		     categ))))
+  (maphash 'org-bbdb-format-vevent org-bbdb-anniv-hash))
 
 (provide 'org-bbdb)