- (let* ((access-type (cdr (assq 'access-type
- (cdr (mm-handle-type handle)))))
- (func (cdr (assq (intern (downcase access-type))
- mm-extern-function-alist)))
- gnus-displaying-mime buf
- handles)
- (unless (mm-handle-cache handle)
- (unless func
- (error (format "Access type (%s) is not supported." access-type)))
- (with-temp-buffer
- (mm-insert-part handle)
- (goto-char (point-max))
- (insert "\n\n")
- (setq handles (mm-dissect-buffer t)))
- (unless (bufferp (car handles))
- (mm-destroy-parts handles)
- (error "Multipart external body is not supported."))
- (save-excursion ;; single part
- (set-buffer (setq buf (mm-handle-buffer handles)))
- (let (good)
- (unwind-protect
- (progn
- (funcall func handle)
- (setq good t))
- (unless good
- (mm-destroy-parts handles))))
- (mm-handle-set-cache handle handles))
- (push handles gnus-article-mime-handles))
- (unless no-display
- (save-excursion
- (save-restriction
- (narrow-to-region (point) (point))
- (gnus-display-mime (mm-handle-cache handle))
- (mm-handle-set-undisplayer
- handle
- `(lambda ()
- (let (buffer-read-only)
- (condition-case nil
- ;; This is only valid on XEmacs.
- (mapcar (lambda (prop)
- (remove-specifier
- (face-property 'default prop) (current-buffer)))
- '(background background-pixmap foreground))
- (error nil))
- (delete-region ,(point-min-marker) ,(point-max-marker))))))))))
-
-;; mm-extern.el ends here
+ (unless (mm-handle-cache handle)
+ (mm-extern-cache-contents handle))
+ (unless no-display
+ (save-excursion
+ (save-restriction
+ (narrow-to-region (point) (point))
+ (mm-display-part (mm-handle-cache handle))))
+ ;; Move undisplayer added to the cached handle to the parent.
+ (mm-handle-set-undisplayer
+ handle (mm-handle-undisplayer (mm-handle-cache handle)))
+ (mm-handle-set-undisplayer (mm-handle-cache handle) nil)))
+
+(provide 'mm-extern)
+
+;;; mm-extern.el ends here