(mime-write-decoded-region): Define method function that uses built-in
authoryamaoka <yamaoka>
Mon, 18 Jun 2007 10:58:54 +0000 (10:58 +0000)
committeryamaoka <yamaoka>
Mon, 18 Jun 2007 10:58:54 +0000 (10:58 +0000)
 base64-decode-region.  [cf. <emacs-mime-ja:02169>]

ChangeLog
mel.el

index 4e0771b..3ebb33b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-06-18  Wencheng Fang  <wencheng.fang@spherenet.co.jp>
+
+       * mel.el (mime-write-decoded-region): Define method function that
+       uses built-in base64-decode-region.  [cf. <emacs-mime-ja:02169>]
+
 2006-12-20  MORIOKA Tomohiko  <tomo@kanji.zinbun.kyoto-u.ac.jp>
 
        * README.ja, README.en (Installation): Update required version of
diff --git a/mel.el b/mel.el
index 44d7a70..90534cb 100644 (file)
--- a/mel.el
+++ b/mel.el
@@ -176,6 +176,15 @@ mmencode included in metamail or XEmacs package)."
               (binary-insert-encoded-file filename)
               (buffer-string))))
     (or (bolp) (insert ?\n)))
+  (mel-define-method mime-write-decoded-region (start end filename
+                                                     (nil "base64"))
+    "Decode the region from START to END and write out to FILENAME."
+    (interactive "*r\nFWrite decoded region to file: ")
+    (let ((str (buffer-substring start end)))
+      (with-temp-buffer
+       (insert str)
+       (base64-decode-region (point-min) (point-max))
+       (write-region-as-binary (point-min) (point-max) filename))))
     
   ;; (mel-define-method-function (encoded-text-encode-string string (nil "B"))
   ;;                             'base64-encode-string)