X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=wl%2Fwl-address.el;h=d168f5254e77a6cafca8d3a312ca53b08ee4d262;hb=c20fb61cd99f50dd4eb03aa29a40b44c802efe17;hp=2ca14ba7bef6f270271f1f4cc29dd8052964e51c;hpb=fc75f559f4386eed5faffe425e6dbd2daa7a465b;p=elisp%2Fwanderlust.git diff --git a/wl/wl-address.el b/wl/wl-address.el index 2ca14ba..d168f52 100644 --- a/wl/wl-address.el +++ b/wl/wl-address.el @@ -46,6 +46,7 @@ (defvar wl-address-list nil) (defvar wl-address-completion-list nil) (defvar wl-address-petname-hash nil) +(defvar wl-address-enable-strict-loading t) (defvar wl-address-ldap-search-hash nil) @@ -288,28 +289,33 @@ Matched address lists are append to CL." (setq addr-tuple (car address-list)) (setq cl (cons - (cons (nth 0 addr-tuple) - (if (or (string= (nth 2 addr-tuple) "") - (string-match ".*:.*;$" (nth 0 addr-tuple))) - (nth 0 addr-tuple) - (concat - (wl-address-quote-specials - (nth 2 addr-tuple)) " <"(nth 0 addr-tuple)">"))) + (wl-address-make-completion-entry 0 addr-tuple) cl)) ;; nickname completion. - (setq cl - (cons - (cons (nth 1 addr-tuple) - (if (or (string= (nth 2 addr-tuple) "") - (string-match ".*:.*;$" (nth 0 addr-tuple))) - (nth 0 addr-tuple) - (concat - (wl-address-quote-specials - (nth 2 addr-tuple)) " <"(nth 0 addr-tuple)">"))) - cl)) + (if wl-address-enable-strict-loading + (unless (or (equal (nth 1 addr-tuple) (nth 0 addr-tuple)) + ;; already exists + (assoc (nth 1 addr-tuple) cl)) + (setq cl + (cons + (wl-address-make-completion-entry 1 addr-tuple) + cl))) + (setq cl + (cons + (wl-address-make-completion-entry 1 addr-tuple) + cl))) (setq address-list (cdr address-list))) cl)) +(defun wl-address-make-completion-entry (index addr-tuple) + (cons (nth index addr-tuple) + (if (or (string= (nth 2 addr-tuple) "") + (string-match ".*:.*;$" (nth 0 addr-tuple))) + (nth 0 addr-tuple) + (concat + (wl-address-quote-specials + (nth 2 addr-tuple)) " <"(nth 0 addr-tuple)">")))) + (defun wl-complete-field-body-or-tab () (interactive) (let ((case-fold-search t) @@ -362,7 +368,7 @@ Matched address lists are append to CL." (with-output-to-temp-buffer wl-completion-buf-name (display-completion-list all)) - (message "Making completion list... done"))) + (message "Making completion list...done"))) (defun wl-complete-window-delete () (let (comp-buf comp-win)