;;; mm-view.el --- functions for viewing MIME objects
-;; Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
;; This file is part of GNU Emacs.
(defvar mm-text-html-washer-alist
'((w3 . gnus-article-wash-html-with-w3)
(w3m . gnus-article-wash-html-with-w3m)
- (w3m-standalone mm-inline-render-with-stdin nil
+ (w3m-standalone mm-inline-wash-with-stdin nil
"w3m" "-dump" "-T" "text/html")
(links mm-inline-wash-with-file
mm-links-remove-leading-blank
(setq mm-w3m-setup t))
(setq w3m-display-inline-images mm-inline-text-html-with-images))
+(defun mm-w3m-cid-retrieve-1 (url handle)
+ (dolist (elem handle)
+ (when (and (listp elem)
+ (equal url (mm-handle-id elem)))
+ (mm-insert-part elem)
+ (throw 'found-handle (mm-handle-media-type elem)))))
+
(defun mm-w3m-cid-retrieve (url &rest args)
"Insert a content pointed by URL if it has the cid: scheme."
(when (string-match "\\`cid:" url)
(setq url (concat "<" (substring url (match-end 0)) ">"))
(catch 'found-handle
- (dolist (handle (with-current-buffer w3m-current-buffer
- gnus-article-mime-handles))
- (when (and (listp handle)
- (equal url (mm-handle-id handle)))
- (mm-insert-part handle)
- (throw 'found-handle (mm-handle-media-type handle)))))))
+ (let ((handles (with-current-buffer w3m-current-buffer
+ gnus-article-mime-handles)))
+ (if (mm-multiple-handles handles)
+ (dolist (handle handles)
+ (mm-w3m-cid-retrieve-1 url handle))
+ (mm-w3m-cid-retrieve-1 url handles))))))
(eval-and-compile
(unless (or (featurep 'xemacs)
(>= emacs-major-version 21))
(defvar mm-w3m-mode-map nil
- "Keymap for text/html part rendered by `mm-w3m-preview-text/html'.
-This map is overwritten by `mm-w3m-local-map-property' based on the
-value of `w3m-minor-mode-map'. Therefore, in order to add some
-commands to this map, add them to `w3m-minor-mode-map' instead of this
-map.")))
+ "Keymap for text/html parts rendered by emacs-w3m.
+This keymap will be bound only when Emacs 20 is running and overwritten
+by the value of `w3m-minor-mode-map'. In order to add some commands to
+this keymap, add them to `w3m-minor-mode-map' instead of this keymap.")))
(defun mm-w3m-local-map-property ()
(when (and (boundp 'w3m-minor-mode-map) w3m-minor-mode-map)
(add-text-properties
(point-min) (point-max)
(nconc (mm-w3m-local-map-property)
+ ;; Put the mark meaning this part was rendered by emacs-w3m.
'(mm-inline-text-html-with-w3m t)))))
(mm-handle-set-undisplayer
handle
gnus-article-prepare-hook
(gnus-newsgroup-charset
(or charset gnus-newsgroup-charset)))
- (run-hooks 'gnus-article-decode-hook)
+ (let ((gnus-original-article-buffer (mm-handle-buffer handle)))
+ (run-hooks 'gnus-article-decode-hook))
(gnus-article-prepare-display)
(setq handles gnus-article-mime-handles))
(goto-char (point-min))