X-Git-Url: https://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fmm-view.el;h=9ea5f7fb1a0f91bef14280d6c4911d2b8fc17da6;hb=8b87e18f7b6e6fced757c12428271a9433d335bd;hp=a33448b059ae943eef7c8c9642d2db6a35e17901;hpb=46ce15860c510f2d8f54a0283d7ce82dba16bca2;p=gnus diff --git a/lisp/mm-view.el b/lisp/mm-view.el index a33448b05..9ea5f7fb1 100644 --- a/lisp/mm-view.el +++ b/lisp/mm-view.el @@ -1,5 +1,6 @@ ;;; mm-view.el --- functions for viewing MIME objects -;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, +;; 2004 Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen ;; This file is part of GNU Emacs. @@ -64,6 +65,11 @@ (html2text html2text)) "The attributes of washer types for text/html.") +(defcustom mm-fill-flowed t + "If non-nil a format=flowed article will be displayed flowed." + :type 'boolean + :group 'mime-display) + ;;; Internal variables. ;;; @@ -74,7 +80,6 @@ (let ((b (point-marker)) buffer-read-only) (put-image (mm-get-image handle) b) - (insert "\n\n") (mm-handle-set-undisplayer handle `(lambda () @@ -198,44 +203,21 @@ (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))))) + (if (mm-multiple-handles handle) + (dolist (elem handle) + (mm-w3m-cid-retrieve-1 url elem)) + (when (and (listp handle) + (equal url (mm-handle-id handle))) + (mm-insert-part handle) + (throw 'found-handle (mm-handle-media-type handle))))) (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 - (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 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) - (if (or (featurep 'xemacs) - (>= emacs-major-version 21)) - (list 'keymap w3m-minor-mode-map) - (list 'local-map - (or mm-w3m-mode-map - (progn - (setq mm-w3m-mode-map (copy-keymap w3m-minor-mode-map)) - (set-keymap-parent mm-w3m-mode-map gnus-article-mode-map) - mm-w3m-mode-map)))))) + (mm-w3m-cid-retrieve-1 (concat "<" (substring url (match-end 0)) ">") + (with-current-buffer w3m-current-buffer + gnus-article-mime-handles))))) (defun mm-inline-text-html-render-with-w3m (handle) "Render a text/html part using emacs-w3m." @@ -257,12 +239,14 @@ this keymap, add them to `w3m-minor-mode-map' instead of this keymap."))) (let ((w3m-safe-url-regexp mm-w3m-safe-url-regexp) w3m-force-redisplay) (w3m-region (point-min) (point-max))) - (when mm-inline-text-html-with-w3m-keymap + (when (and mm-inline-text-html-with-w3m-keymap + (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))))) + (list 'keymap w3m-minor-mode-map + ;; Put the mark meaning this part was rendered by emacs-w3m. + 'mm-inline-text-html-with-w3m t)))) (mm-handle-set-undisplayer handle `(lambda () @@ -366,7 +350,8 @@ this keymap, add them to `w3m-minor-mode-map' instead of this keymap."))) (mm-insert-part handle) (goto-char (point-max))) (insert (mm-decode-string (mm-get-part handle) charset))) - (when (and (equal type "plain") + (when (and mm-fill-flowed + (equal type "plain") (equal (cdr (assoc 'format (mm-handle-type handle))) "flowed")) (save-restriction