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)
51 (setq mm-w3-setup t)))
53 (defun mm-inline-text (handle)
54 (let ((type (cadr (split-string (car (mm-handle-type handle)) "/")))
55 text buffer-read-only)
58 (setq text (mm-get-part handle))
60 (charset (mail-content-type-get
61 (mm-handle-type handle) 'charset)))
62 (insert (mm-decode-string text charset))
64 (narrow-to-region b (point))
65 (mm-handle-set-undisplayer
68 (let (buffer-read-only)
70 ,(set-marker (make-marker) (point-min))
71 ,(set-marker (make-marker) (point-max)))))))))
74 (setq text (mm-get-part handle))
76 (width (window-width)))
80 (narrow-to-region b (point))
81 (save-window-excursion
82 (let ((w3-strict-width width))
83 (w3-region (point-min) (point-max)))))
84 (mm-handle-set-undisplayer
87 (let (buffer-read-only)
90 (face-property 'default prop) (current-buffer)))
91 '(background background-pixmap foreground))
93 ,(set-marker (make-marker) (point-min))
94 ,(set-marker (make-marker) (point-max)))))))))
95 ((or (equal type "enriched")
96 (equal type "richtext"))
98 (mm-with-unibyte-buffer
99 (insert-buffer-substring (mm-handle-buffer handle))
100 (mm-decode-content-transfer-encoding
101 (mm-handle-encoding handle)
102 (car (mm-handle-type handle)))
103 (save-window-excursion
104 (enriched-decode (point-min) (point-max))
105 (setq text (buffer-string)))))
106 (mm-insert-inline handle text))
109 (mm-with-unibyte-buffer
110 (insert-buffer-substring (mm-handle-buffer handle))
111 (mm-decode-content-transfer-encoding
112 (mm-handle-encoding handle)
113 (car (mm-handle-type handle)))
114 (setq text (buffer-string))))
115 (mm-insert-inline handle text)))))
117 (defun mm-insert-inline (handle text)
118 "Insert TEXT inline from HANDLE."
121 (mm-handle-set-undisplayer
124 (let (buffer-read-only)
125 (delete-region ,(set-marker (make-marker) b)
126 ,(set-marker (make-marker) (point))))))))
128 (defun mm-inline-audio (handle)
129 (message "Not implemented"))
131 (defun mm-view-sound-file ()
132 (message "Not implemented"))
134 (defun mm-w3-prepare-buffer ()
140 ;; mm-view.el ends here