X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=wl%2Fwl-addrmgr.el;h=8443e58d5a03fae76ad83ab79a8587d88fdbe37a;hb=8a81d3a3caef0f94f9721361a749f0b6429f30ce;hp=4714a90a933f13b782fcd8f7d7deec541c8c6b7f;hpb=dffdd4400e6d175456b864975da56d7fb59d62c0;p=elisp%2Fwanderlust.git diff --git a/wl/wl-addrmgr.el b/wl/wl-addrmgr.el index 4714a90..8443e58 100644 --- a/wl/wl-addrmgr.el +++ b/wl/wl-addrmgr.el @@ -171,6 +171,28 @@ See info under Wanderlust for full documentation. (wl-parse-addresses (mapconcat 'identity (elmo-multiple-fields-body-list (list field)) ",")))) +(defun wl-addrmgr-pickup-entry-list (buffer) + "Return a list of address entiry from BUFFER." + (when buffer + (with-current-buffer buffer + (mapcar + (lambda (addr) + (let ((structure (std11-extract-address-components addr))) + (list (cadr structure) + (or (car structure) "") + (or (car structure) "")))) + (wl-parse-addresses + (mapconcat + 'identity + (elmo-multiple-fields-body-list '("to" "cc" "bcc")) ",")))))) + +(defun wl-addrmgr-merge-entries (base-list append-list) + "Return a merged list of address entiry." + (dolist (entry append-list) + (unless (assoc (car entry) base-list) + (setq base-list (nconc base-list (list entry))))) + base-list) + ;;;###autoload (defun wl-addrmgr () "Start an Address manager." @@ -201,7 +223,9 @@ See info under Wanderlust for full documentation. (unless wl-addrmgr-sort-order (setq wl-addrmgr-sort-order wl-addrmgr-default-sort-order)) (setq wl-addrmgr-draft-buffer buffer) - (setq wl-addrmgr-list (wl-addrmgr-list)) + (setq wl-addrmgr-list + (wl-addrmgr-merge-entries (wl-addrmgr-list) + (wl-addrmgr-pickup-entry-list buffer))) (wl-addrmgr-draw already-list) (setq wl-addrmgr-unknown-list already-list) (wl-addrmgr-goto-top))) @@ -362,13 +386,16 @@ Return nil if no ADDRESS exists." (forward-char 4))))) (defun wl-addrmgr-quit-yes () - (if (and wl-addrmgr-draft-buffer - (buffer-live-p wl-addrmgr-draft-buffer) - (null (get-buffer-window wl-addrmgr-draft-buffer))) - (switch-to-buffer wl-addrmgr-draft-buffer) - (unless (one-window-p) - (delete-window))) - (kill-buffer wl-addrmgr-buffer-name)) + (let ((draft-buffer wl-addrmgr-draft-buffer)) + (if (and draft-buffer + (buffer-live-p draft-buffer) + (null (get-buffer-window draft-buffer 'visible))) + (switch-to-buffer draft-buffer) + (unless (one-window-p) + (delete-window))) + (kill-buffer wl-addrmgr-buffer-name) + (if (and draft-buffer (not (one-window-p))) + (switch-to-buffer-other-window draft-buffer)))) (defun wl-addrmgr-quit () "Exit from electric reference mode without inserting reference." @@ -578,7 +605,9 @@ Return nil if no ADDRESS exists." (cond ((string= mark "To:") (setq to-list (cons - (if (and full (not (string= realname ""))) + (if (and full + (not (or (string= realname "") + (string-match ".*:.*;$" addr)))) (concat (wl-address-quote-specials realname) " <" addr">") @@ -586,7 +615,9 @@ Return nil if no ADDRESS exists." to-list))) ((string= mark "Cc:") (setq cc-list (cons - (if (and full (not (string= realname ""))) + (if (and full + (not (or (string= realname "") + (string-match ".*:.*;$" addr)))) (concat (wl-address-quote-specials realname) " <" addr">") @@ -594,7 +625,9 @@ Return nil if no ADDRESS exists." cc-list))) ((string= mark "Bcc:") (setq bcc-list (cons - (if (and full (not (string= realname ""))) + (if (and full + (not (or (string= realname "") + (string-match ".*:.*;$" addr)))) (concat (wl-address-quote-specials realname) " <" addr">") @@ -613,8 +646,8 @@ Return nil if no ADDRESS exists." (when (or (null wl-addrmgr-draft-buffer) (not (buffer-live-p wl-addrmgr-draft-buffer))) (setq wl-addrmgr-draft-buffer (save-window-excursion - (wl-draft) - (current-buffer)))) + (call-interactively 'wl-draft) + (current-buffer)))) (with-current-buffer wl-addrmgr-draft-buffer (setq from (std11-field-body "From")) (if from