From: morioka Date: Thu, 11 Jun 1998 14:08:54 +0000 (+0000) Subject: (mime-raw-play-entity): Change interface of internal-method. X-Git-Tag: remi-1_6_0~12 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=1cb083f8f4bd89338d7893d47213d5dfb0ee020f;p=elisp%2Fsemi.git (mime-raw-play-entity): Change interface of internal-method. (mime-method-to-save): Change interface. (mime-method-to-display-message/rfc822): Change interface. (mime-method-to-store-message/partial): Change interface. (mime-method-to-display-message/external-ftp): Change interface. (mime-method-to-display-caesar): Change interface. --- diff --git a/mime-play.el b/mime-play.el index 83ef4ca..ce4d45f 100644 --- a/mime-play.el +++ b/mime-play.el @@ -76,13 +76,13 @@ If MODE is specified, play as it. Default MODE is \"play\"." (interactive) (or mode (setq mode "play")) - (let ((entity-info (get-text-property (point) 'mime-view-entity))) - (if entity-info + (let ((entity (get-text-property (point) 'mime-view-entity))) + (if entity (let ((the-buf (current-buffer)) (raw-buffer (get-text-property (point) 'mime-view-raw-buffer))) (setq mime-preview-after-decoded-position (point)) (set-buffer raw-buffer) - (mime-raw-play-entity entity-info mode) + (mime-raw-play-entity entity mode) (when (eq (current-buffer) raw-buffer) (set-buffer the-buf) (goto-char mime-preview-after-decoded-position) @@ -130,15 +130,15 @@ If MODE is specified, play as it. Default MODE is \"play\"." (setq situations (cdr situations))) dest)) -(defun mime-raw-play-entity (entity-info &optional mode) - "Play entity specified by ENTITY-INFO. +(defun mime-raw-play-entity (entity &optional mode) + "Play entity specified by ENTITY. It decodes the entity to call internal or external method. The method is selected from variable `mime-acting-condition'. If MODE is specified, play as it. Default MODE is \"play\"." - (let ((beg (mime-entity-point-min entity-info)) - (end (mime-entity-point-max entity-info))) + (let ((beg (mime-entity-point-min entity)) + (end (mime-entity-point-max entity))) (let (method cal ret) - (setq cal (mime-entity-situation entity-info)) + (setq cal (mime-entity-situation entity)) (if mode (setq cal (cons (cons 'mode mode) cal)) ) @@ -176,7 +176,7 @@ specified, play as it. Default MODE is \"play\"." (setq method (cdr (assq 'method ret))) (cond ((and (symbolp method) (fboundp method)) - (funcall method beg end ret) + (funcall method entity ret) ) ((stringp method) (mime-activate-mailcap-method beg end ret) @@ -186,7 +186,7 @@ specified, play as it. Default MODE is \"play\"." ) (t (mime-show-echo-buffer "No method are specified for %s\n" - (mime-entity-type/subtype entity-info)) + (mime-entity-type/subtype entity)) )) ))) @@ -378,36 +378,36 @@ window.") ;;; @ file extraction ;;; -(defun mime-method-to-save (beg end cal) - (goto-char beg) - (let* ((name - (save-restriction - (narrow-to-region beg end) - (mime-raw-get-filename cal) - )) - (encoding (or (cdr (assq 'encoding cal)) "7bit")) - (filename - (if (and name (not (string-equal name ""))) - (expand-file-name name - (save-window-excursion - (call-interactively - (function - (lambda (dir) - (interactive "DDirectory: ") - dir))))) - (save-window-excursion - (call-interactively - (function - (lambda (file) - (interactive "FFilename: ") - (expand-file-name file))))))) - ) - (if (file-exists-p filename) - (or (yes-or-no-p (format "File %s exists. Save anyway? " filename)) - (error ""))) - (re-search-forward "\n\n") - (mime-write-decoded-region (match-end 0) end filename encoding) - )) +(defun mime-method-to-save (entity cal) + (let ((beg (mime-entity-point-min entity)) + (end (mime-entity-point-max entity))) + (goto-char beg) + (let* ((name (save-restriction + (narrow-to-region beg end) + (mime-raw-get-filename cal) + )) + (encoding (or (cdr (assq 'encoding cal)) "7bit")) + (filename (if (and name (not (string-equal name ""))) + (expand-file-name name + (save-window-excursion + (call-interactively + (function + (lambda (dir) + (interactive "DDirectory: ") + dir))))) + (save-window-excursion + (call-interactively + (function + (lambda (file) + (interactive "FFilename: ") + (expand-file-name file))))))) + ) + (if (file-exists-p filename) + (or (yes-or-no-p (format "File %s exists. Save anyway? " filename)) + (error ""))) + (re-search-forward "\n\n") + (mime-write-decoded-region (match-end 0) end filename encoding) + ))) ;;; @ mail/news message @@ -425,8 +425,10 @@ It is registered to variable `mime-preview-quitting-method-alist'." (pop-to-buffer mother) )) -(defun mime-method-to-display-message/rfc822 (beg end cal) - (let* ((cnum (mime-raw-point-to-entity-number beg)) +(defun mime-method-to-display-message/rfc822 (entity cal) + (let* ((beg (mime-entity-point-min entity)) + (end (mime-entity-point-max entity)) + (cnum (mime-raw-point-to-entity-number beg)) (new-name (format "%s-%s" (buffer-name) cnum)) (mother mime-preview-buffer) (representation-type @@ -466,8 +468,8 @@ saved as binary. Otherwise the region is saved by `write-region'." (write-region start end filename) ))) -(defun mime-method-to-store-message/partial (beg end cal) - (goto-char beg) +(defun mime-method-to-store-message/partial (entity cal) + (goto-char (mime-entity-point-min entity)) (let* ((root-dir (expand-file-name (concat "m-prts-" (user-login-name)) mime-temp-directory)) @@ -476,7 +478,7 @@ saved as binary. Otherwise the region is saved by `write-region'." (total (cdr (assoc "total" cal))) file (mother mime-preview-buffer) - ) + ) (or (file-exists-p root-dir) (make-directory root-dir) ) @@ -507,7 +509,7 @@ saved as binary. Otherwise the region is saved by `write-region'." (re-search-forward "^$") (goto-char (1+ (match-end 0))) (setq file (concat root-dir "/" number)) - (mime-raw-write-region (point) end file) + (mime-raw-write-region (point) (mime-entity-point-max entity) file) (let ((total-file (concat root-dir "/CT"))) (setq total (if total @@ -552,8 +554,8 @@ saved as binary. Otherwise the region is saved by `write-region'." (setq i (1+ i)) )) (as-binary-output-file - (write-region (point-min)(point-max) - (expand-file-name "FULL" root-dir))) + (write-region (point-min)(point-max) + (expand-file-name "FULL" root-dir))) (let ((i 1)) (while (<= i total) (let ((file (format "%s/%d" root-dir i))) @@ -598,13 +600,11 @@ saved as binary. Otherwise the region is saved by `write-region'." (dired dir) )) -(defun mime-method-to-display-message/external-ftp (beg end cal) +(defun mime-method-to-display-message/external-ftp (entity cal) (let* ((site (cdr (assoc "site" cal))) (directory (cdr (assoc "directory" cal))) (name (cdr (assoc "name" cal))) - ;;(mode (cdr (assoc "mode" cal))) - (pathname (concat "/anonymous@" site ":" directory)) - ) + (pathname (concat "/anonymous@" site ":" directory))) (message (concat "Accessing " (expand-file-name name pathname) "...")) (funcall mime-raw-dired-function pathname) (goto-char (point-min)) @@ -615,10 +615,9 @@ saved as binary. Otherwise the region is saved by `write-region'." ;;; @ rot13-47 ;;; -(defun mime-method-to-display-caesar (start end cal) +(defun mime-method-to-display-caesar (entity situation) "Internal method for mime-view to display ROT13-47-48 message." - (let* ((entity (mime-raw-find-entity-from-point start)) - (new-name (format "%s-%s" (buffer-name) + (let* ((new-name (format "%s-%s" (buffer-name) (mime-entity-number entity))) (mother mime-preview-buffer)) (let ((pwin (or (get-buffer-window mother)