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

ChangeLog
mel.el

index 3375bed..741982f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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>]
+
+\f
 2005-12-25  MORIOKA Tomohiko  <tomo@kanji.zinbun.kyoto-u.ac.jp>
 
        * FLIM: Version 1.14.8 (Shij\e-Dò) released.\e-A
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)