- (save-excursion
- (w3-do-setup)
- (mm-with-unibyte-buffer
- (insert-buffer-substring (mm-handle-buffer handle))
- (mm-decode-content-transfer-encoding
- (mm-handle-encoding handle)
- (car (mm-handle-type handle)))
- (require 'url)
- (save-window-excursion
- (w3-region (point-min) (point-max))
- (setq text (buffer-string))))
- (mm-insert-inline handle text)))
+ (mm-setup-w3)
+ (setq text (mm-get-part handle))
+ (let ((b (point))
+ (url-standalone-mode t)
+ (url-current-object
+ (url-generic-parse-url (format "cid:%s" (mm-handle-id handle))))
+ (width (window-width))
+ (charset (mail-content-type-get
+ (mm-handle-type handle) 'charset)))
+ (save-excursion
+ (insert text)
+ (save-restriction
+ (narrow-to-region b (point))
+ (goto-char (point-min))
+ (if (or (re-search-forward
+ w3-meta-content-type-charset-regexp nil t)
+ (re-search-forward
+ w3-meta-charset-content-type-regexp nil t))
+ (setq charset (w3-coding-system-for-mime-charset
+ (buffer-substring-no-properties
+ (match-beginning 2)
+ (match-end 2)))))
+ (delete-region (point-min) (point-max))
+ (insert (mm-decode-string text charset))
+ (save-window-excursion
+ (save-restriction
+ (let ((w3-strict-width width)
+ (url-standalone-mode t))
+ (condition-case var
+ (w3-region (point-min) (point-max))
+ (error)))))
+ (mm-handle-set-undisplayer
+ handle
+ `(lambda ()
+ (let (buffer-read-only)
+ (if (functionp 'remove-specifier)
+ (mapc (lambda (prop)
+ (remove-specifier
+ (face-property 'default prop) (current-buffer)))
+ '(background background-pixmap foreground)))
+ (delete-region ,(point-min-marker)
+ ,(point-max-marker)))))))))