From: yoichi Date: Sun, 23 May 2004 06:35:44 +0000 (+0000) Subject: * wl-vars.el (wl-user-mail-address-regexp): New variable. X-Git-Tag: wl-2_11_30~37 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42f82edbfeff92ec0a0565df9c49fef0d6e54a87;p=elisp%2Fwanderlust.git * wl-vars.el (wl-user-mail-address-regexp): New variable. * wl-address.el (wl-address-user-mail-address-p): Use it. (wl-address-delete-user-mail-addresses): Ditto. Suggested by David Bremner , [wl-en:463] --- diff --git a/wl/ChangeLog b/wl/ChangeLog index fde867a..494b316 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,5 +1,10 @@ 2004-05-23 Yoichi NAKAYAMA + * wl-vars.el (wl-user-mail-address-regexp): New variable. + * wl-address.el (wl-address-user-mail-address-p): Use it. + (wl-address-delete-user-mail-addresses): Ditto. + Suggested by David Bremner , [wl-en:463] + * wl-address.el (wl-address-user-mail-address-p): defsubst->defun. (wl-address-delete-user-mail-addresses): Ditto. diff --git a/wl/wl-address.el b/wl/wl-address.el index ecdbc22..439b737 100644 --- a/wl/wl-address.el +++ b/wl/wl-address.el @@ -592,23 +592,32 @@ e.g. \"Mr. bar \" (defun wl-address-user-mail-address-p (address) "Judge whether ADDRESS is user's or not." - (member (downcase (wl-address-header-extract-address address)) - (or (mapcar 'downcase wl-user-mail-address-list) - (list (downcase - (wl-address-header-extract-address - wl-from)))))) + (if wl-user-mail-address-regexp + (string-match wl-user-mail-address-regexp + (wl-address-header-extract-address address)) + (member (downcase (wl-address-header-extract-address address)) + (or (mapcar 'downcase wl-user-mail-address-list) + (list (downcase + (wl-address-header-extract-address + wl-from))))))) (defun wl-address-delete-user-mail-addresses (address-list) "Delete user mail addresses from list by side effect. Deletion is done by using `elmo-list-delete'." - (let ((myself (or wl-user-mail-address-list - (list (wl-address-header-extract-address wl-from))))) - (elmo-list-delete myself address-list - (lambda (elem list) - (elmo-delete-if - (lambda (item) (string= (downcase elem) - (downcase item))) - list))))) + (if wl-user-mail-address-regexp + (elmo-list-delete (list wl-user-mail-address-regexp) address-list + (lambda (elem list) + (elmo-delete-if + (lambda (item) (string-match elem item)) + list))) + (let ((myself (or wl-user-mail-address-list + (list (wl-address-header-extract-address wl-from))))) + (elmo-list-delete myself address-list + (lambda (elem list) + (elmo-delete-if + (lambda (item) (string= (downcase elem) + (downcase item))) + list)))))) (defmacro wl-address-concat-token (string token) (` (cond diff --git a/wl/wl-vars.el b/wl/wl-vars.el index 335d49b..fd877fb 100644 --- a/wl/wl-vars.el +++ b/wl/wl-vars.el @@ -144,11 +144,20 @@ "*A list of user's mail addresses. This list is used to judge whether an address is user's or not. You should set this variable if you use multiple e-mail addresses. -If you don't have multiple e-mail addresses, you don't have to set this." +If you don't have multiple e-mail addresses, you don't have to set this. +NOTE: Non-nil value of `wl-user-mail-address-regexp' supersede this." :type '(repeat string) :group 'wl :group 'wl-setting) +(defcustom wl-user-mail-address-regexp nil + "*A regexp for user's mail addresses. +Supersede `wl-user-mail-address-list'." + :type '(choice (const :tag "Use wl-user-mail-address-list" nil) + string) + :group 'wl + :group 'wl-setting) + (defcustom wl-organization (getenv "ORGANIZATION") "Organization name." :type '(choice (const :tag "none" nil)