(TopLevel): Use `mu-cite-default-methods-alist' instead of
authoryamaoka <yamaoka>
Mon, 19 Jul 1999 08:26:16 +0000 (08:26 +0000)
committeryamaoka <yamaoka>
Mon, 19 Jul 1999 08:26:16 +0000 (08:26 +0000)
`mu-cite/default-methods-alist'.
(mu-cite/get-bbdb-prefix-register-method): Use `mu-cite-minibuffer-history'
instead of `mu-cite/minibuffer-history'.
(mu-bbdb-get-prefix-register-verbose-method): Use `mu-cite-get-value' instead
of `mu-cite/get-value'.
(mu-bbdb-get-prefix-register-method): Likewise.
(mu-bbdb-get-prefix-method): Likewise.
(mu-bbdb-load-hook): Use `defcustom' instead of `defvar'.
(mu-bbdb): New customization group.
(TopLevel): Define old functions as obsolete aliases.
(mu-bbdb-set-attr): Renamed from `mu-cite/set-bbdb-attr'.
(mu-bbdb-get-prefix-register-verbose-method): Renamed from
`mu-cite/get-bbdb-prefix-register-verbose-method'.
(mu-bbdb-get-prefix-register-method): Renamed from
`mu-cite/get-bbdb-prefix-register-method'.
(mu-bbdb-get-prefix-method): Renamed from
`mu-cite/get-bbdb-prefix-method'.
(mu-bbdb-get-attr): Renamed from `mu-cite/get-bbdb-attr'.
(TopLevel): Require `path-util' for picking up `module-installed-p'.
(TopLevel): Require `cl' at the compile time.
(Keywords, Maintainer): Add comments.
(Author): Change mail address.
(Copyright): Belong FSF.

mu-bbdb.el

index d8c5844..672db40 100644 (file)
@@ -1,9 +1,10 @@
 ;;; mu-bbdb.el --- `attribution' function for mu-cite with BBDB.
 
-;; Copyright (C) 1996,1997 Shuhei KOBAYASHI
+;; Copyright (C) 1995,1996,1997,1998,1999 Free Software Foundation, Inc.
 
-;; Author: Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
-;; Version: $Id: mu-bbdb.el,v 3.3 1996/12/10 11:57:23 shuhei-k Exp $
+;; Author: Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
+;; Maintainer: Katsumi Yamaoka <yamaoka@jpl.org>
+;; Keywords: mail, news, citation, bbdb
 
 ;; This file is part of MU (Message Utilities).
 
 \f
 ;;; Code:
 
+(eval-when-compile (require 'cl))
+
+;; Pickup `module-installed-p'.
+(require 'path-util)
+
 (require 'mu-cite)
-(if (module-installed-p 'bbdb)
-    (require 'bbdb))
+(when (module-installed-p 'bbdb)
+  (require 'bbdb))
 
-(defvar mu-bbdb-load-hook nil
-  "*List of functions called after mu-bbdb is loaded.")
 
-;;; @@ prefix and registration using BBDB
+;;; @ obsolete functions
 ;;;
 
-(defun mu-cite/get-bbdb-prefix-method ()
-  (or (mu-cite/get-bbdb-attr (mu-cite/get-value 'address))
-      ">")
+;; This part will be abolished in the future.
+
+(eval-and-compile
+  (defconst mu-bbdb-obsolete-function-alist
+    '((mu-cite/get-bbdb-attr           mu-bbdb-get-attr)
+      (mu-cite/get-bbdb-prefix-method  mu-bbdb-get-prefix-method)
+      (mu-cite/get-bbdb-prefix-register-method
+       mu-bbdb-get-prefix-register-method)
+      (mu-cite/get-bbdb-prefix-register-verbose-method
+       mu-bbdb-get-prefix-register-verbose-method)
+      (mu-cite/set-bbdb-attr           mu-bbdb-set-attr)))
+
+  (mapcar
+   (function (lambda (elem)
+              (apply (function define-obsolete-function-alias) elem)))
+   mu-bbdb-obsolete-function-alist)
   )
 
-(defun mu-cite/get-bbdb-attr (addr)
+
+;;; @ set up
+;;;
+
+(defgroup mu-bbdb nil
+  "`attribution' function for mu-cite with BBDB."
+  :prefix "mu-bbdb-"
+  :group 'mu-cite
+  :group 'bbdb)
+
+(defcustom mu-bbdb-load-hook nil
+  "List of functions called after mu-bbdb is loaded."
+  :type 'hook
+  :group 'mu-bbdb)
+
+
+;;; @@ prefix and registration using BBDB
+;;;
+
+(defun mu-bbdb-get-prefix-method ()
+  (or (mu-bbdb-get-attr (mu-cite-get-value 'address))
+      ">"))
+
+(defun mu-bbdb-get-attr (addr)
   "Extract attribute information from BBDB."
   (let ((record (bbdb-search-simple nil addr)))
-    (and record
-         (bbdb-record-getprop record 'attribution))
-    ))
+    (when record
+      (bbdb-record-getprop record 'attribution))))
 
-(defun mu-cite/set-bbdb-attr (attr addr)
+(defun mu-bbdb-set-attr (attr addr)
   "Add attribute information to BBDB."
   (let* ((bbdb-notice-hook nil)
-         (record (bbdb-annotate-message-sender
-                  addr t
-                 (bbdb-invoke-hook-for-value
-                  bbdb/mail-auto-create-p)
+        (record (bbdb-annotate-message-sender
+                 addr t
+                 (bbdb-invoke-hook-for-value
+                  bbdb/mail-auto-create-p)
                  t)))
-    (if record
-        (progn
-          (bbdb-record-putprop record 'attribution attr)
-          (bbdb-change-record record nil))
-      )))
-
-(defun mu-cite/get-bbdb-prefix-register-method ()
-  (let ((addr (mu-cite/get-value 'address)))
-    (or (mu-cite/get-bbdb-attr addr)
-       (let ((return
+    (when record
+      (bbdb-record-putprop record 'attribution attr)
+      (bbdb-change-record record nil))))
+
+(defun mu-bbdb-get-prefix-register-method ()
+  (let ((addr (mu-cite-get-value 'address)))
+    (or (mu-bbdb-get-attr addr)
+       (let ((return
               (read-string "Citation name? "
-                           (or (mu-cite/get-value 'x-attribution)
-                               (mu-cite/get-value 'full-name))
-                           'mu-cite/minibuffer-history)
-              ))
+                           (or (mu-cite-get-value 'x-attribution)
+                               (mu-cite-get-value 'full-name))
+                           'mu-cite-minibuffer-history)))
          (if (and (not (string-equal return ""))
-                   (y-or-n-p (format "Register \"%s\"? " return)))
-             (mu-cite/set-bbdb-attr return addr)
-           )
+                  (y-or-n-p (format "Register \"%s\"? " return)))
+             (mu-bbdb-set-attr return addr))
          return))))
 
-(defun mu-cite/get-bbdb-prefix-register-verbose-method ()
-  (let* ((addr (mu-cite/get-value 'address))
-         (attr (mu-cite/get-bbdb-attr addr))
+(defun mu-bbdb-get-prefix-register-verbose-method ()
+  (let* ((addr (mu-cite-get-value 'address))
+        (attr (mu-bbdb-get-attr addr))
         (return (read-string "Citation name? "
                              (or attr
-                                 (mu-cite/get-value 'x-attribution)
-                                 (mu-cite/get-value 'full-name))
-                             'mu-cite/minibuffer-history))
-        )
+                                 (mu-cite-get-value 'x-attribution)
+                                 (mu-cite-get-value 'full-name))
+                             'mu-cite-minibuffer-history)))
     (if (and (not (string-equal return ""))
-             (not (string-equal return attr))
-            (y-or-n-p (format "Register \"%s\"? " return))
-            )
-       (mu-cite/set-bbdb-attr return addr)
-      )
+            (not (string-equal return attr))
+            (y-or-n-p (format "Register \"%s\"? " return)))
+       (mu-bbdb-set-attr return addr))
     return))
 
-(or (assoc 'bbdb-prefix mu-cite/default-methods-alist)
-    (setq mu-cite/default-methods-alist
-          (append mu-cite/default-methods-alist
-                  (list
-                   (cons 'bbdb-prefix
-                         (function mu-cite/get-bbdb-prefix-method))
-                   (cons 'bbdb-prefix-register
-                         (function mu-cite/get-bbdb-prefix-register-method))
-                   (cons 'bbdb-prefix-register-verbose
-                         (function
-                          mu-cite/get-bbdb-prefix-register-verbose-method))
-                   ))))
+(unless (assoc 'bbdb-prefix mu-cite-default-methods-alist)
+  (setq mu-cite-default-methods-alist
+       (append mu-cite-default-methods-alist
+               (list
+                (cons 'bbdb-prefix
+                      (function mu-bbdb-get-prefix-method))
+                (cons 'bbdb-prefix-register
+                      (function mu-bbdb-get-prefix-register-method))
+                (cons 'bbdb-prefix-register-verbose
+                      (function
+                       mu-bbdb-get-prefix-register-verbose-method))))))
 
 \f
 ;;; @ end