Move `mel-encoding-module-alist' to mime-def.el.
authormorioka <morioka>
Thu, 8 Oct 1998 05:48:19 +0000 (05:48 +0000)
committermorioka <morioka>
Thu, 8 Oct 1998 05:48:19 +0000 (05:48 +0000)
(mel-find-function): Use function `mel-find-function-from-obarray'.
Use `mel-define-backend' to define "7bit", "8bit" and "binary"; don't
define methods of "8bit" and "binary"; inherit methods from "7bit".

mel.el

diff --git a/mel.el b/mel.el
index e0a1339..8a7f457 100644 (file)
--- a/mel.el
+++ b/mel.el
@@ -34,8 +34,6 @@
   :group 'mime
   :type '(repeat string))
 
-(defvar mel-encoding-module-alist nil)
-
 (defun mime-encoding-list (&optional service)
   "Return list of Content-Transfer-Encoding.
 If SERVICE is specified, it returns available list of
@@ -74,18 +72,8 @@ Content-Transfer-Encoding for it."
       )))
 
 (defsubst mel-find-function (service encoding)
-  (let* ((oba (symbol-value (intern (format "%s-obarray" service))))
-        (f (intern-soft encoding oba)))
-    (or f
-       (let ((rest (cdr (assoc encoding mel-encoding-module-alist))))
-         (while (and rest
-                     (progn
-                       (require (car rest))
-                       (null (setq f (intern-soft encoding oba)))
-                       ))
-           (setq rest (cdr rest))
-           )
-         f))))
+  (mel-find-function-from-obarray
+   (symbol-value (intern (format "%s-obarray" service))) encoding))
 
 
 ;;; @ setting for modules
@@ -111,6 +99,7 @@ Content-Transfer-Encoding for it."
     (mel-use-module 'mel-b-dl '("base64" "B"))
   )
 
+(mel-define-backend "7bit")
 (mel-define-method-function (mime-encode-string string (nil "7bit"))
                            'identity)
 (mel-define-method-function (mime-decode-string string (nil "7bit"))
@@ -123,29 +112,9 @@ Content-Transfer-Encoding for it."
                             start end filename (nil "7bit"))
                            'write-region-as-binary)
 
-(mel-define-method-function (mime-encode-string string (nil "8bit"))
-                           'identity)
-(mel-define-method-function (mime-decode-string string (nil "8bit"))
-                           'identity)
-(mel-define-method mime-encode-region (start end (nil "8bit")))
-(mel-define-method mime-decode-region (start end (nil "8bit")))
-(mel-define-method-function (mime-insert-encoded-file filename (nil "8bit"))
-                           'insert-file-contents-as-binary)
-(mel-define-method-function (mime-write-decoded-region
-                            start end filename (nil "8bit"))
-                           'write-region-as-binary)
+(mel-define-backend "8bit" ("7bit"))
 
-(mel-define-method-function (mime-encode-string string (nil "binary"))
-                           'identity)
-(mel-define-method-function (mime-decode-string string (nil "binary"))
-                           'identity)
-(mel-define-method mime-encode-region (start end (nil "binary")))
-(mel-define-method mime-decode-region (start end (nil "binary")))
-(mel-define-method-function (mime-insert-encoded-file filename (nil "binary"))
-                           'insert-file-contents-as-binary)
-(mel-define-method-function (mime-write-decoded-region
-                            start end filename (nil "binary"))
-                           'write-region-as-binary)
+(mel-define-backend "binary" ("8bit"))
 
 
 ;;; @ region