From mboxrd@z Thu Jan 1 00:00:00 1970 From: Feng Shu Subject: [patch] add 'tel' and 'note' property Date: Fri, 05 Apr 2013 10:22:17 +0800 Message-ID: <87ehep3eee.fsf@news.tumashu-localhost.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:34761) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNwIM-0007P8-46 for emacs-orgmode@gnu.org; Thu, 04 Apr 2013 22:22:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNwIK-0007yz-JW for emacs-orgmode@gnu.org; Thu, 04 Apr 2013 22:22:26 -0400 Received: from mail-da0-x231.google.com ([2607:f8b0:400e:c00::231]:65405) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNwIK-0007yf-9m for emacs-orgmode@gnu.org; Thu, 04 Apr 2013 22:22:24 -0400 Received: by mail-da0-f49.google.com with SMTP id t11so1373376daj.22 for ; Thu, 04 Apr 2013 19:22:22 -0700 (PDT) Received: from feng by tumashu with local (Exim 4.80) (envelope-from ) id 1UNwIE-0003gg-0c for emacs-orgmode@gnu.org; Fri, 05 Apr 2013 10:22:18 +0800 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0001-Let-org-contacts.el-has-the-ability-which-can-export.patch Content-Transfer-Encoding: quoted-printable >From 94cb96299561618ec237e8cb17cc27bdb38218ac Mon Sep 17 00:00:00 2001 From: Feng Shu 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: name1@test.org; name2@test.org, name3@test.org name4@test.org :END: The export result is like: BEGIN:VCARD VERSION:3.0 N:Name;;; FN:Name EMAIL:name1@test.org EMAIL:name2@test.org EMAIL:name3@test.org EMAIL:name4@test.org END:VCARD --- contrib/lisp/org-contacts.el | 10 ++++++++-- 1 =E4=B8=AA=E6=96=87=E4=BB=B6=E8=A2=AB=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=8F=92= =E5=85=A5 8 =E8=A1=8C(+)=EF=BC=8C=E5=88=A0=E9=99=A4 2 =E8=A1=8C(-) 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-birthda= y-property properties)))) (addr (cdr (assoc-string org-contacts-address-property properties))) (nick (org-contacts-vcard-escape (cdr (assoc-string org-contacts-nicknam= e-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 --=20 1.7.10.4 --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-org-contacts.el-add-note-property.patch Content-Transfer-Encoding: quoted-printable >From fee9e6afbf38db8dcf94763d1e07ca2b35342dea Mon Sep 17 00:00:00 2001 From: Feng Shu 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 =E4=B8=AA=E6=96=87=E4=BB=B6=E8=A2=AB=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=8F=92= =E5=85=A5 6 =E8=A1=8C(+) 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) =20 +(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"))) =20 (defun org-contacts-export-as-vcard (&optional name file to-buffer) --=20 1.7.10.4 --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0003-org-contacts.el-add-tel-property.patch Content-Transfer-Encoding: quoted-printable >From 38ef150badd21eb0c5d9159e6444cdeeb1252380 Mon Sep 17 00:00:00 2001 From: Feng Shu 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 =E4=B8=AA=E6=96=87=E4=BB=B6=E8=A2=AB=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=8F=92= =E5=85=A5 12 =E8=A1=8C(+) 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) =20 +(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" --=20 1.7.10.4 --=-=-= Content-Type: text/plain -- --=-=-=--