>From 94cb96299561618ec237e8cb17cc27bdb38218ac Mon Sep 17 00:00:00 2001 From: Feng Shu <tuma...@gmail.com> Date: Fri, 5 Apr 2013 09:47:04 +0800 Subject: [PATCH 1/3] Let org-contacts.el has the ability which can export email-address list
* org-contacts.el (org-contacts-vcard-format): let the function work with email-address list. The org-contact file is : * Name :PROPERTIES: :EMAIL: na...@test.org; na...@test.org, na...@test.org na...@test.org :END: The export result is like: BEGIN:VCARD VERSION:3.0 N:Name;;; FN:Name EMAIL:na...@test.org EMAIL:na...@test.org EMAIL:na...@test.org EMAIL:na...@test.org END:VCARD --- contrib/lisp/org-contacts.el | 10 ++++++++-- 1 个文件被修改,插入 8 行(+),删除 2 行(-) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index e78b9da..b85ae2d 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -819,13 +819,19 @@ to do our best." (let* ((properties (caddr contact)) (name (org-contacts-vcard-escape (car contact))) (n (org-contacts-vcard-encode-name name)) - (email (org-contacts-vcard-escape (cdr (assoc-string org-contacts-email-property properties)))) + (email (cdr (assoc-string org-contacts-email-property properties))) (bday (org-contacts-vcard-escape (cdr (assoc-string org-contacts-birthday-property properties)))) (addr (cdr (assoc-string org-contacts-address-property properties))) (nick (org-contacts-vcard-escape (cdr (assoc-string org-contacts-nickname-property properties)))) (head (format "BEGIN:VCARD\nVERSION:3.0\nN:%s\nFN:%s\n" n name))) (concat head - (when email (format "EMAIL:%s\n" email)) + (when email (progn + (setq emails-list (split-string email "[,;: ]+")) + (setq result "") + (while emails-list + (setq result (concat result "EMAIL:" (car emails-list) "\n")) + (setq emails-list (cdr emails-list))) + result)) (when addr (format "ADR:;;%s\n" (replace-regexp-in-string "\\, ?" ";" addr))) (when bday -- 1.7.10.4
>From fee9e6afbf38db8dcf94763d1e07ca2b35342dea Mon Sep 17 00:00:00 2001 From: Feng Shu <tuma...@gmail.com> Date: Fri, 5 Apr 2013 09:54:06 +0800 Subject: [PATCH 2/3] org-contacts.el, add note property * org-contacts.el (org-contacts-note-property): New varible which add note property (org-contacts-vcard-format): Add the ability exporting note property --- contrib/lisp/org-contacts.el | 6 ++++++ 1 个文件被修改,插入 6 行(+) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index b85ae2d..5f16d41 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -71,6 +71,11 @@ When set to nil, all your Org files will be used." :type 'string :group 'org-contacts) +(defcustom org-contacts-note-property "NOTE" + "Name of the property for contact note." + :type 'string + :group 'org-contacts) + (defcustom org-contacts-birthday-format "Birthday: %l (%Y)" "Format of the anniversary agenda entry. The following replacements are available: @@ -841,6 +846,7 @@ to do our best." (calendar-extract-month cal-bday) (calendar-extract-day cal-bday)))) (when nick (format "NICKNAME:%s\n" nick)) + (when note (format "NOTE:%s\n" note)) "END:VCARD\n\n"))) (defun org-contacts-export-as-vcard (&optional name file to-buffer) -- 1.7.10.4
>From 38ef150badd21eb0c5d9159e6444cdeeb1252380 Mon Sep 17 00:00:00 2001 From: Feng Shu <tuma...@gmail.com> Date: Fri, 5 Apr 2013 09:59:55 +0800 Subject: [PATCH 3/3] org-contacts.el, add tel property * org-contacts.el (org-contacts-tel-property): New variable, add tel property (org-contacts-vcard-format): Add the ability exporting tel property --- contrib/lisp/org-contacts.el | 12 ++++++++++++ 1 个文件被修改,插入 12 行(+) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index 5f16d41..8172c80 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -61,6 +61,11 @@ When set to nil, all your Org files will be used." :type 'string :group 'org-contacts) +(defcustom org-contacts-tel-property "PHONE" + "Name of the property for contact phone number." + :type 'string + :group 'org-contacts) + (defcustom org-contacts-address-property "ADDRESS" "Name of the property for contact address." :type 'string @@ -839,6 +844,13 @@ to do our best." result)) (when addr (format "ADR:;;%s\n" (replace-regexp-in-string "\\, ?" ";" addr))) + (when tel (progn + (setq phones-list (split-string tel "[,;: ]+")) + (setq result "") + (while phones-list + (setq result (concat result "TEL:" (car phones-list) "\n")) + (setq phones-list (cdr phones-list))) + result)) (when bday (let ((cal-bday (calendar-gregorian-from-absolute (org-time-string-to-absolute bday)))) (format "BDAY:%04d-%02d-%02d\n" -- 1.7.10.4
--