WEMI 1.10.0 - "Shin-Kambara": Sync up with semi-1_10.
[elisp/semi.git] / mime-text.el
1 ;;; mime-text.el --- mime-view content filter for text
2
3 ;; Copyright (C) 1994,1995,1996,1997,1998 Free Software Foundation, Inc.
4
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: text, MIME, multimedia, mail, news
7
8 ;; This file is part of WEMI (Widget based Emacs MIME Interfaces).
9
10 ;; This program is free software; you can redistribute it and/or
11 ;; modify it under the terms of the GNU General Public License as
12 ;; published by the Free Software Foundation; either version 2, or (at
13 ;; your option) any later version.
14
15 ;; This program is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 ;; General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;;; Code:
26
27 (require 'mime-view)
28 (autoload 'widget-convert-text "wid-edit")
29
30
31 ;;; @ content filters for mime-text
32 ;;;
33
34 (defun mime-display-text/plain (entity situation)
35   (save-restriction
36     (narrow-to-region (point-max)(point-max))
37     (mime-insert-text-content entity)
38     (run-hooks 'mime-text-decode-hook)
39     (goto-char (point-max))
40     (if (not (eq (char-after (1- (point))) ?\n))
41         (insert "\n")
42       )
43     (mime-add-url-buttons)
44     (run-hooks 'mime-display-text/plain-hook)
45     ))
46
47 (defun mime-display-text/richtext (entity situation)
48   (save-restriction
49     (narrow-to-region (point-max)(point-max))
50     (mime-insert-text-content entity)
51     (run-hooks 'mime-text-decode-hook)
52     (let ((beg (point-min)))
53       (remove-text-properties beg (point-max) '(face nil))
54       (richtext-decode beg (point-max))
55       )))
56
57 (defun mime-display-text/enriched (entity situation)
58   (save-restriction
59     (narrow-to-region (point-max)(point-max))
60     (mime-insert-text-content entity)
61     (run-hooks 'mime-text-decode-hook)
62     (let ((beg (point-min)))
63       (remove-text-properties beg (point-max) '(face nil))
64       (enriched-decode beg (point-max))
65       )))
66
67
68 ;;; @ end
69 ;;;
70
71 (provide 'mime-text)
72
73 ;;; mime-text.el ends here