From: keiichi Date: Wed, 5 Jan 2000 06:03:15 +0000 (+0000) Subject: (mmgnus-entity-body): New function. X-Git-Tag: nana-gnus-7_1_0_16~51 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec5211139dc68f901c844c4a77c4d81bb90dcc0a;p=elisp%2Fgnus.git- (mmgnus-entity-body): New function. (mime-entity-content): Use `mmgnus-entity-body'. (mime-insert-entity-content): New method. (mime-write-entity-content): Likewise. (mime-insert-entity): Likewise. (mime-write-entity): Likewise. (mime-write-entity-body): Likewise. --- diff --git a/lisp/mmgnus.el b/lisp/mmgnus.el index b068338..9bcd755 100644 --- a/lisp/mmgnus.el +++ b/lisp/mmgnus.el @@ -93,6 +93,15 @@ (insert "\n") )))))) +(defun mmgnus-entity-body (entity) + (cond + ((bufferp (mmgnus-entity-body-internal entity)) + (with-current-buffer (mmgnus-entity-body-internal entity) + (buffer-string))) + (t + (error "Invalid body object. %s" + (mmgnus-entity-body-internal entity))))) + (luna-define-method mime-insert-header ((entity mmgnus-entity) &optional invisible-fields visible-fields) @@ -101,14 +110,33 @@ invisible-fields visible-fields)) (luna-define-method mime-entity-content ((entity mmgnus-entity)) - (save-excursion - (cond - ((bufferp (mmgnus-entity-body-internal entity)) - (set-buffer (mmgnus-entity-body-internal entity)) - (mime-decode-string (buffer-string) (mime-entity-encoding entity))) - (t - (error "Invalid body object. %s" - (mmgnus-entity-body-internal entity)))))) + (mime-decode-string (mmgnus-entity-body entity) + (mime-entity-encoding entity))) + +(luna-define-method mime-insert-entity-content ((entity mmgnus-entity)) + (insert (mime-entity-content entity))) + +(luna-define-method mime-write-entity-content ((entity mmgnus-entity) filename) + (with-temp-buffer + (insert (mmgnus-entity-body entity)) + (mime-write-decoded-region (point-min) (point-max) + filename + (or (mime-entity-encoding entity) "7bit")))) + +(luna-define-method mime-insert-entity ((entity mmgnus-entity)) + (insert (mmgnus-entity-header-internal entity) + "\n" + (mmgnus-entity-body entity))) + +(luna-define-method mime-write-entity ((entity mmgnus-entity) filename) + (with-temp-buffer + (mime-insert-entity entity) + (write-region-as-raw-text-CRLF (point-min) (point-max) filename))) + +(luna-define-method mime-write-entity-body ((entity mmgnus-entity) filename) + (with-temp-buffer + (insert (mmgnus-entity-body entity)) + (write-region-as-binary (point-min) (point-max) filename))) (luna-define-class mime-gnus-entity (mmgnus-entity) (number