From 4a36f4a5988e212aa0eb036ed78de2e226057d31 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 5 May 2011 11:09:43 +0200 Subject: [PATCH] Merge org-contacts-wl in org-contacts * org-contacts.el: Merge org-contacts-wl.el Signed-off-by: Julien Danjou --- org-contacts.el | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/org-contacts.el b/org-contacts.el index 06137d7..3f4d97c 100644 --- a/org-contacts.el +++ b/org-contacts.el @@ -403,6 +403,32 @@ This adds `org-contacts-gnus-check-mail-address' and (add-hook 'gnus-article-prepare-hook 'org-contacts-gnus-check-mail-address) (add-hook 'gnus-article-prepare-hook 'org-contacts-gnus-store-last-mail)) +(defun wl-get-from-header-content () + (save-excursion + (set-buffer (org-capture-get :original-buffer)) + (cond + ((eq major-mode 'wl-summary-mode) (when wl-summary-buffer-elmo-folder + (elmo-message-field + wl-summary-buffer-elmo-folder + (wl-summary-message-number) + 'from))) + ((eq major-mode 'mime-view-mode) (std11-narrow-to-header) + (prog1 + (std11-fetch-field "From") + (widen)))))) + +(defun org-contacts-template-wl-name (&optional return-value) + (let ((from (wl-get-from-header-content))) + (or (and from (wl-address-header-extract-realname from)) + return-value + "%^{Name}"))) + +(defun org-contacts-template-wl-email (&optional return-value) + (let ((from (wl-get-from-header-content))) + (or (and from (wl-address-header-extract-address from)) + return-value + (concat "%^{" org-contacts-email-property "}p")))) + (defun org-contacts-view-send-email (&optional ask) "Send email to the contact at point. If ASK is set, ask for the email address even if there's only one address."