From 49d26c0e042d38db1a4c63118819e73d2e658b4e Mon Sep 17 00:00:00 2001 From: morioka Date: Thu, 21 Jan 1999 18:55:13 +0000 Subject: [PATCH] Abolish variable `mime-preview-after-decoded-position'. (mime-preview-play-current-entity): Use `mime-play-entity' simply; don't switch to raw-buffer. (mime-play-entity): renamed from `mime-raw-play-entity'; don't expect called in raw-buffer. (mime-activate-mailcap-method): Don't expect called in raw-buffer. (mime-show-echo-buffer): Permit to run in preview-buffer. --- mime-play.el | 72 +++++++++++++++++++++++----------------------------------- 1 file changed, 29 insertions(+), 43 deletions(-) diff --git a/mime-play.el b/mime-play.el index 65949f3..9f008ce 100644 --- a/mime-play.el +++ b/mime-play.el @@ -114,8 +114,6 @@ ;;; @ content decoder ;;; -(defvar mime-preview-after-decoded-position nil) - (defun mime-preview-play-current-entity (&optional ignore-examples mode) "Play current entity. It decodes current entity to call internal or external method. The @@ -126,15 +124,8 @@ If MODE is specified, play as it. Default MODE is \"play\"." (interactive "P") (let ((entity (get-text-property (point) 'mime-view-entity))) (if entity - (let ((the-buf (current-buffer)) - (raw-buffer (mime-entity-buffer entity))) - (setq mime-preview-after-decoded-position (point)) - (set-buffer raw-buffer) - (mime-raw-play-entity entity (or mode "play") nil ignore-examples) - (when (eq (current-buffer) raw-buffer) - (set-buffer the-buf) - (goto-char mime-preview-after-decoded-position) - ))))) + (mime-play-entity entity (or mode "play") nil ignore-examples) + ))) (defun mime-sort-situation (situation) (sort situation @@ -202,8 +193,8 @@ If MODE is specified, play as it. Default MODE is \"play\"." (cons match example) )) -(defun mime-raw-play-entity (entity &optional mode situation ignore-examples - ignored-method) +(defun mime-play-entity (entity &optional mode situation ignore-examples + ignored-method) "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 @@ -314,34 +305,28 @@ specified, play as it. Default MODE is \"play\"." (defvar mime-mailcap-method-filename-alist nil) (defun mime-activate-mailcap-method (entity situation) - (save-excursion - (save-restriction - (let ((start (mime-entity-point-min entity)) - (end (mime-entity-point-max entity))) - (narrow-to-region start end) - (goto-char start) - (let ((method (cdr (assoc 'method situation))) - (name (mime-entity-safe-filename entity))) - (setq name - (if (and name (not (string= name ""))) - (expand-file-name name temporary-file-directory) - (make-temp-name - (expand-file-name "EMI" temporary-file-directory)) - )) - (mime-write-entity-content entity name) - (message "External method is starting...") - (let ((process - (let ((command - (mailcap-format-command - method - (cons (cons 'filename name) situation)))) - (start-process command mime-echo-buffer-name - shell-file-name shell-command-switch command) - ))) - (set-alist 'mime-mailcap-method-filename-alist process name) - (set-process-sentinel process 'mime-mailcap-method-sentinel) - ) - ))))) + (let ((method (cdr (assoc 'method situation))) + (name (mime-entity-safe-filename entity))) + (setq name + (if (and name (not (string= name ""))) + (expand-file-name name temporary-file-directory) + (make-temp-name + (expand-file-name "EMI" temporary-file-directory)) + )) + (mime-write-entity-content entity name) + (message "External method is starting...") + (let ((process + (let ((command + (mailcap-format-command + method + (cons (cons 'filename name) situation)))) + (start-process command mime-echo-buffer-name + shell-file-name shell-command-switch command) + ))) + (set-alist 'mime-mailcap-method-filename-alist process name) + (set-process-sentinel process 'mime-mailcap-method-sentinel) + ) + )) (defun mime-mailcap-method-sentinel (process event) (let ((file (cdr (assq process mime-mailcap-method-filename-alist)))) @@ -376,7 +361,8 @@ window.") (condition-case nil (setq win (get-buffer-window bbdb-buffer-name)) (error nil))) - (select-window (get-buffer-window mime-preview-buffer)) + (select-window (get-buffer-window (or mime-preview-buffer + (current-buffer)))) (setq win (split-window-vertically (- (window-height) (if (functionp mime-echo-window-height) @@ -483,7 +469,7 @@ SUBTYPE is symbol to indicate subtype of media-type.") t))) (setq rest (cdr rest)))) (if type - (mime-raw-play-entity + (mime-play-entity entity nil (put-alist 'type type (put-alist 'subtype subtype -- 1.7.10.4