* wl-util.el: Move (eval-when-compile (require 'static)).
[elisp/wanderlust.git] / utils / wl-addrbook.el
index a650467..5a8c3a9 100644 (file)
@@ -100,8 +100,8 @@ If nil,  the old 'user' entry remains.")
 
 ;; hash table for wl-addrbook-alist
 (defmacro wl-addrbook-hashtb ()
-  (` (or wl-addrbook-hashtb
-        (setq wl-addrbook-hashtb (elmo-make-hash 1021)))))
+  '(or wl-addrbook-hashtb
+       (setq wl-addrbook-hashtb (elmo-make-hash 1021))))
 
 (defsubst wl-addrbook-get-record-by-addr (addr &optional alist)
   (elmo-get-hash-val (downcase addr) (wl-addrbook-hashtb)))
@@ -137,7 +137,7 @@ If nil,  the old 'user' entry remains.")
   (setq wl-address-init-function 'wl-addrbook-init)
   ;;
   (when wl-summary-use-addrbook-from-func
-    (setq wl-summary-from-function 'wl-summary-addrbook-from))
+    (setq wl-summary-get-petname-function 'wl-addrbook-get-nickname))
   (define-key wl-summary-mode-map "\C-c\C-a" 'wl-summary-addrbook-add)
   (define-key wl-draft-mode-map "\C-i"     'wl-draft-addrbook-header-comp-or-tab)
   (define-key wl-draft-mode-map "\e\t"     'wl-draft-addrbook-expand)
@@ -151,7 +151,7 @@ If nil,  the old 'user' entry remains.")
          (setq wl-alias-auto-alist
                (elmo-object-load (expand-file-name
                                   wl-alias-auto-file-name
-                                  elmo-msgdb-dir)))))
+                                  elmo-msgdb-directory)))))
   (setq wl-addrbook-alist (wl-addrbook-make-alist))
   ;; wl-alias-auto-alist is used independently so must use copy-alist
   (if wl-addrbook-alist
@@ -164,7 +164,7 @@ If nil,  the old 'user' entry remains.")
   (wl-addrbook-make-hashtb)
   (add-hook 'kill-emacs-hook (function wl-addrbook-clean-up))
   (add-hook 'wl-exit-hook (function wl-addrbook-clean-up))
-  (message "Updating addrbook...done."))
+  (message "Updating addrbook...done"))
 
 (defun wl-addrbook-clean-up ()
   (remove-hook 'kill-emacs-hook (function wl-addrbook-clean-up))
@@ -172,7 +172,7 @@ If nil,  the old 'user' entry remains.")
   (when wl-alias-auto-file-name
     (elmo-object-save (expand-file-name
                       wl-alias-auto-file-name
-                      elmo-msgdb-dir)
+                      elmo-msgdb-directory)
                      wl-alias-auto-alist)
     (setq wl-alias-auto-alist nil)
     (setq wl-addrbook-hashtb nil)))
@@ -180,10 +180,10 @@ If nil,  the old 'user' entry remains.")
 ;;
 
 (defmacro wl-alias-get (key)
-  (` (wl-addrbook-alias-get (, key) wl-addrbook-alist)))
+  `(wl-addrbook-alias-get ,key wl-addrbook-alist))
 
 (defmacro wl-alias-next (key)
-  (` (wl-addrbook-alias-next (, key) wl-addrbook-alist)))
+  `(wl-addrbook-alias-next ,key wl-addrbook-alist))
 
 (defalias 'wl-addrbook-alias-hit 'wl-addrbook-get-record-by-alias)
 
@@ -553,37 +553,10 @@ The keys that are defined for this mode are:
 ;;; Show nick name of Addrbook in summary.
 ;;;
 
-(defsubst wl-addrbook-get-names (names)
-  (let (addrs)
-    (mapconcat
-     (function
-      (lambda (name)
-       (or (wl-addrbook-nickname-get
-            (wl-address-header-extract-address name))
-           (and (setq addrs (std11-extract-address-components name))
-                (or (car addrs) (cadr addrs))))))
-     (wl-parse-addresses names)
-     ",")))
-
-(eval-when-compile (defvar-maybe entity nil)) ; silence byte compiler.
-(defun wl-summary-addrbook-from (from)
-  "A candidate for wl-summary-from-function.
-Show destination in summary matched by `wl-summary-show-dest-folder-regexp'.
-And use Addrbook for get user name."
-  (let ((fromaddr (wl-address-header-extract-address from))
-       dest)
-    (or
-     (and (eq major-mode 'wl-summary-mode)
-         (string-match wl-summary-showto-folder-regexp
-                       wl-summary-buffer-folder-name)
-         (wl-address-user-mail-address-p fromaddr)
-         (cond ((setq dest (elmo-msgdb-overview-entity-get-to entity))
-                (concat "To:" (eword-decode-string (wl-addrbook-get-names dest))))
-               ((setq dest (elmo-msgdb-overview-entity-get-extra-field
-                            entity "newsgroups"))
-                (concat "Ng:" dest))))
-     (wl-addrbook-nickname-get fromaddr)
-     from)))
+(defun wl-addrbook-get-nickname (mailbox)
+  "For `wl-summary-get-petname-function'."
+  (wl-addrbook-nickname-get
+   (wl-address-header-extract-address mailbox)))
 
 (provide 'wl-addrbook)