1 ;;; mm-view.el --- Functions for viewing MIME objects
2 ;; Copyright (C) 1998 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
5 ;; This file is part of GNU Emacs.
7 ;; GNU Emacs is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; GNU Emacs is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU Emacs; see the file COPYING. If not, write to the
19 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 ;; Boston, MA 02111-1307, USA.
32 ;;; Functions for displaying various formats inline
35 (defun mm-inline-image (handle)
36 (let ((annot (make-annotation (mm-get-image handle) nil 'text))
38 (mm-insert-inline handle ".\n")
39 (set-extent-property annot 'mm t)
40 (set-extent-property annot 'duplicable t)))
42 (defvar mm-w3-setup nil)
49 (setq mm-w3-setup t)))
51 (defun mm-inline-text (handle)
52 (let ((type (cadr (split-string (car (mm-handle-type handle)) "/")))
53 text buffer-read-only)
56 (setq text (mm-get-part handle))
58 (charset (mail-content-type-get
59 (mm-handle-type handle) 'charset)))
60 (insert (mm-decode-string text charset))
62 (narrow-to-region b (point))
63 (mm-handle-set-undisplayer
66 (let (buffer-read-only)
67 (delete-region ,(point-min-marker) ,(point-max-marker))))))))
70 (setq text (mm-get-part handle))
72 (url-standalone-mode t)
73 (width (window-width)))
77 (narrow-to-region b (point))
78 (save-window-excursion
79 (let ((w3-strict-width width))
80 (w3-region (point-min) (point-max)))))
81 (mm-handle-set-undisplayer
84 (let (buffer-read-only)
87 (face-property 'default prop) (current-buffer)))
88 '(background background-pixmap foreground))
89 (delete-region ,(point-min-marker) ,(point-max-marker))))))))
90 ((or (equal type "enriched")
91 (equal type "richtext"))
93 (mm-with-unibyte-buffer
94 (insert-buffer-substring (mm-handle-buffer handle))
95 (mm-decode-content-transfer-encoding
96 (mm-handle-encoding handle)
97 (car (mm-handle-type handle)))
98 (save-window-excursion
99 (enriched-decode (point-min) (point-max))
100 (setq text (buffer-string)))))
101 (mm-insert-inline handle text))
104 (mm-with-unibyte-buffer
105 (insert-buffer-substring (mm-handle-buffer handle))
106 (mm-decode-content-transfer-encoding
107 (mm-handle-encoding handle)
108 (car (mm-handle-type handle)))
109 (setq text (buffer-string))))
110 (mm-insert-inline handle text)))))
112 (defun mm-insert-inline (handle text)
113 "Insert TEXT inline from HANDLE."
116 (mm-handle-set-undisplayer
119 (let (buffer-read-only)
120 (delete-region ,(set-marker (make-marker) b)
121 ,(set-marker (make-marker) (point))))))))
123 (defun mm-inline-audio (handle)
124 (message "Not implemented"))
126 (defun mm-view-sound-file ()
127 (message "Not implemented"))
129 (defun mm-w3-prepare-buffer ()
134 (autoload 'gnus-article-prepare-display "gnus-art"))
136 (defun mm-view-message ()
137 (gnus-article-prepare-display)
142 ;; mm-view.el ends here