[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] phone links...
From: |
Feng Shu |
Subject: |
Re: [O] phone links... |
Date: |
Sat, 13 Apr 2013 22:12:45 +0800 |
User-agent: |
Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2 (gnu/linux) |
Michael Strey <address@hidden> writes:
> Robert,
>
> On Mo, Apr 08, 2013 at 09:44:12 -0500, Robert Goldman wrote:
>> Michael Strey wrote:
>> > Currently org-phone.el as well as my org-dial.el are incompatible with
>> > org-contacts. The only idea behind my proposal was to make the
>> > contributors
>> > of both packages aware of each other.
>>
>> Can you explain what makes org-phone incompatible with org-contacts?
>> Maybe my naming of some function?
>
> The problem is on the side of org-contacts. Org-contacts does not
> support links in its properties. Thus, currently the only solution to
> use the advantages of org-contacts and org-phone is to give the
> information twice, like in the following example.
> #+BEGIN_SRC org
> * Strey, Michael
> :PROPERTIES:
> :EMAIL: address@hidden address@hidden
> :PHONE: +493514129535 +491263213
> :END:
>
> [[mailto:address@hidden
> [[mailto:address@hidden
> [[phone:+49 (0)351 41295-35]]
> [[phone:+49 126 3213]]
> #+END_SRC
I use a export function which can export all contacts to the format:
#+begin_example
* NAME
** EMAIL: [[mailto:address@hidden
** EMAIL: [[mailto:address@hidden
** PHONE: [[tel:123456789]]
** PHONE: [[tel:123456789]]
#+end_example
It it only a temporary solution, may be someone will need it ,but adding it to
the master may
be not a good idea.
>From 2c73cdfdf54fe4c882a3bc0d3ce3cd268555100e Mon Sep 17 00:00:00 2001
From: Feng Shu <address@hidden>
Date: Sat, 13 Apr 2013 22:00:03 +0800
Subject: [PATCH] org-contacts.el, export contacts to outline-format
* contrib/lisp/org-contacts.el (org-contacts-outline-file): new
variable
(org-contacts-outline-format): new function which formats a contact to
outline-format
(org-contacts-export-as-outline-format): new function, formats all
contacts to outline-format
* NAME
:PROPERTIES:
:EMAIL: address@hidden address@hidden
:PHONE: 123456789
:END:
export as:
* NAME
** EMAIL: [[mailto:address@hidden
** EMAIL: [[mailto:address@hidden
** PHONE: [[tel:123456789]]
** PHONE: [[tel:123456789]]
---
contrib/lisp/org-contacts.el | 69 ++++++++++++++++++++++++++++++++++++++++++
1 个文件被修改,插入 69 行(+)
diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el
index a3c4aed..dd89251 100644
--- a/contrib/lisp/org-contacts.el
+++ b/contrib/lisp/org-contacts.el
@@ -156,6 +156,12 @@ This overrides `org-email-link-description-format' if set."
:group 'org-contacts
:type 'file)
+(defcustom org-contacts-outline-file "contacts-outline.org"
+ "Default file for outline-format export."
+ :group 'org-contacts
+ :type 'file)
+
+
(defcustom org-contacts-enable-completion t
"Enable or not the completion in `message-mode' with `org-contacts'."
:group 'org-contacts
@@ -896,6 +902,69 @@ is created and the VCard is written into that buffer."
(current-buffer)
(progn (save-buffer) (kill-buffer)))))
+(defun org-contacts-outline-format (contact)
+ "Formats CONTACT in outline format."
+ (let* ((properties (caddr contact))
+ (name (org-contacts-vcard-escape (car contact)))
+ (n (org-contacts-vcard-encode-name name))
+ (email (cdr (assoc-string org-contacts-email-property properties)))
+ (tel (cdr (assoc-string org-contacts-tel-property properties)))
+ (note (cdr (assoc-string org-contacts-note-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 "* %s\n" name)))
+ (concat head
+ (when email (progn
+ (setq emails-list (split-string email "[,;: ]+"))
+ (setq result "")
+ (while emails-list
+ (setq result (concat result "** EMAIL: " (concat
"[[mailto:" (car emails-list) "]]") "\n"))
+ (setq emails-list (cdr emails-list)))
+ result))
+ (when addr
+ (format "** ADRESS: " (replace-regexp-in-string "\\, ?" ";"
addr)))
+ (when tel (progn
+ (setq phones-list (split-string tel "[,;: ]+"))
+ (setq result "")
+ (while phones-list
+ (setq result (concat result "** TEL: " (concat
"[[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"
+ (calendar-extract-year cal-bday)
+ (calendar-extract-month cal-bday)
+ (calendar-extract-day cal-bday))))
+ (when nick (format "** NICKNAME: %s\n" nick))
+ (when note (format "** NOTE: %s\n" note)))))
+
+
+
+(defun org-contacts-export-as-outline-format (&optional name file to-buffer)
+ "Export all contacts matching NAME as outline format
+If TO-BUFFER is nil, the content is written to FILE or
+`org-contacts-outline-file'. If TO-BUFFER is non-nil, the buffer
+is created and the outlines is written into that buffer."
+ (interactive) ; TODO ask for name?
+ (let* ((filename (or file org-contacts-outline-file))
+ (buffer (if to-buffer
+ (get-buffer-create to-buffer)
+ (find-file-noselect filename))))
+ (message "Exporting...")
+ (set-buffer buffer)
+ (let ((inhibit-read-only t)) (erase-buffer))
+ (fundamental-mode)
+ (when (fboundp 'set-buffer-file-coding-system)
+ (set-buffer-file-coding-system coding-system-for-write))
+ (loop for contact in (org-contacts-filter name)
+ do (insert (org-contacts-outline-format contact)))
+ (if to-buffer
+ (current-buffer)
+ (progn (save-buffer) (kill-buffer)))))
+
+
(defun org-contacts-show-map (&optional name)
"Show contacts on a map.
Requires google-maps-el."
--
1.7.10.4
>
> This shortcoming effects not only the phone links but email links as
> well.
>
> Regards
--
- Re: [O] phone links..., (continued)
Re: [O] phone links..., Robert P. Goldman, 2013/04/04
- Re: [O] phone links..., Michael Strey, 2013/04/08
- Re: [O] phone links..., Robert Goldman, 2013/04/08
- Re: [O] phone links..., Michael Strey, 2013/04/08
- Re: [O] phone links..., Robert Goldman, 2013/04/08
- Re: [O] phone links..., Michael Strey, 2013/04/09
- Re: [O] phone links..., Robert Goldman, 2013/04/09
- Re: [O] phone links..., Michael Strey, 2013/04/09
Re: [O] phone links...,
Feng Shu <=
Re: [O] phone links..., Feng Shu, 2013/04/14
Re: [O] phone links..., Bastien, 2013/04/14
Re: [O] phone links..., Feng Shu, 2013/04/15
Re: [O] phone links..., Bastien, 2013/04/15
Re: [O] phone links..., Feng Shu, 2013/04/15
Re: [O] phone links..., Daimrod, 2013/04/16
Re: [O] phone links..., Feng Shu, 2013/04/16
Re: [O] phone links..., Daimrod, 2013/04/17
Re: [O] phone links..., Michael Strey, 2013/04/14
Re: [O] phone links..., Daimrod, 2013/04/16