From 99dee7748e3f38479f1bf346f2d98ce7978a0194 Mon Sep 17 00:00:00 2001 From: morioka Date: Tue, 6 Oct 1998 19:10:57 +0000 Subject: [PATCH] Define method functions of mel. (mime-encode-region): Use `mel-define-method-function'; abolish `gzip64-encode-region'. (mime-decode-region): Use `mel-define-method-function'; abolish `gzip64-decode-region'. (mime-encode-string): New method. (mime-decode-string): New method. (mime-insert-encoded-file): Use `mel-define-method'; abolish `gzip64-insert-encoded-file'. (mime-write-decoded-region): Use `mel-define-method'; abolish `gzip64-write-decoded-region'. --- mel-g.el | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/mel-g.el b/mel-g.el index 73db30f..bc2c510 100644 --- a/mel-g.el +++ b/mel-g.el @@ -82,21 +82,40 @@ ) )) -(defalias 'gzip64-encode-region 'gzip64-external-encode-region) -(defalias 'gzip64-decode-region 'gzip64-external-decode-region) +(mel-define-method-function (mime-encode-region start end (nil "x-gzip64")) + 'gzip64-external-encode-region) +(mel-define-method-function (mime-decode-region start end (nil "x-gzip64")) + 'gzip64-external-decode-region) + + +;;; @ encoder/decoder for string +;;; + +(mel-define-method mime-encode-string (string (nil "x-gzip64")) + (with-temp-buffer + (insert string) + (gzip64-external-encode-region (point-min)(point-max)) + (buffer-string))) + +(mel-define-method mime-decode-string (string (nil "x-gzip64")) + (with-temp-buffer + (insert string) + (gzip64-external-decode-region (point-min)(point-max)) + (buffer-string))) ;;; @ encoder/decoder for file ;;; -(defun gzip64-insert-encoded-file (filename) +(mel-define-method mime-insert-encoded-file (filename (nil "x-gzip64")) (interactive (list (read-file-name "Insert encoded file: "))) (apply (function call-process) (car gzip64-external-encoder) filename t nil (cdr gzip64-external-encoder)) ) -(defun gzip64-write-decoded-region (start end filename) +(mel-define-method mime-write-decoded-region (start end filename + (nil "x-gzip64")) "Decode and write current region encoded by gzip64 into FILENAME. START and END are buffer positions." (interactive -- 1.7.10.4