4
|
1 ;;;
|
|
2 ;;; tm-rich.el --- text/enriched and text/richtext style
|
|
3 ;;; richtext filter for tm-view
|
|
4 ;;;
|
|
5 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
|
|
6 ;;; Copyright (C) 1994 .. 1996 MORIOKA Tomohiko
|
|
7 ;;;
|
|
8 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
|
|
9 ;;; Version:
|
|
10 ;;; $Id: tm-rich.el,v 1.1.1.1 1996/12/18 03:55:32 steve Exp $
|
|
11 ;;; Keywords: mail, news, MIME, multimedia, richtext, enriched
|
|
12 ;;;
|
|
13 ;;; This file is part of tm (Tools for MIME).
|
|
14 ;;;
|
|
15 ;;; This program is free software; you can redistribute it and/or
|
|
16 ;;; modify it under the terms of the GNU General Public License as
|
|
17 ;;; published by the Free Software Foundation; either version 2, or
|
|
18 ;;; (at your option) any later version.
|
|
19 ;;;
|
|
20 ;;; This program is distributed in the hope that it will be useful,
|
|
21 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
23 ;;; General Public License for more details.
|
|
24 ;;;
|
|
25 ;;; You should have received a copy of the GNU General Public License
|
|
26 ;;; along with This program. If not, write to the Free Software
|
|
27 ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
28 ;;;
|
|
29 ;;; Code:
|
|
30
|
|
31 (require 'tm-view)
|
|
32
|
|
33 (defvar tm-rich/richtext-module
|
|
34 (if (or running-emacs-19_29-or-later
|
|
35 running-xemacs-20
|
|
36 (and running-xemacs (>= emacs-minor-version 14)))
|
|
37 'richtext
|
|
38 'tinyrich))
|
|
39
|
|
40 (require tm-rich/richtext-module)
|
|
41
|
|
42
|
|
43 ;;; @ content filters for tm-view
|
|
44 ;;;
|
|
45
|
|
46 (defun mime-viewer/filter-text/richtext (ctype params encoding)
|
|
47 (let* ((mode mime::preview/original-major-mode)
|
|
48 (m (assq mode mime-viewer/code-converter-alist))
|
|
49 (charset (assoc "charset" params))
|
|
50 ;; 1995/9/21 (c.f. tm-eng:105), 1995/10/3 (c.f. tm-eng:121)
|
|
51 ;; modified by Eric Ding <ericding@San-Jose.ate.slb.com>
|
|
52 (beg (point-min)) (end (point-max))
|
|
53 )
|
|
54 (remove-text-properties beg end '(face nil))
|
|
55 (mime/decode-region encoding beg end)
|
|
56 (if (and m (fboundp (setq m (cdr m))))
|
|
57 (funcall m beg (point-max) charset encoding)
|
|
58 (mime-viewer/default-code-convert-region beg (point-max)
|
|
59 charset encoding)
|
|
60 )
|
|
61 (richtext-decode beg (point-max))
|
|
62 ))
|
|
63
|
|
64 (defun mime-viewer/filter-text/enriched (ctype params encoding)
|
|
65 (let* ((mode mime::preview/original-major-mode)
|
|
66 (m (assq mode mime-viewer/code-converter-alist))
|
|
67 (charset (assoc "charset" params))
|
|
68 ;; 1995/9/21 (c.f. tm-eng:105), 1995/10/3 (c.f. tm-eng:121)
|
|
69 ;; modified by Eric Ding <ericding@San-Jose.ate.slb.com>
|
|
70 (beg (point-min)) (end (point-max))
|
|
71 )
|
|
72 (remove-text-properties beg end '(face nil))
|
|
73 (mime/decode-region encoding beg end)
|
|
74 (if (and m (fboundp (setq m (cdr m))))
|
|
75 (funcall m beg (point-max) charset encoding)
|
|
76 (mime-viewer/default-code-convert-region beg (point-max)
|
|
77 charset encoding)
|
|
78 )
|
|
79 (enriched-decode beg (point-max))
|
|
80 ))
|
|
81
|
|
82
|
|
83 ;;; @ setting
|
|
84 ;;;
|
|
85
|
|
86 (set-alist 'mime-viewer/content-filter-alist
|
|
87 "text/richtext" (function mime-viewer/filter-text/richtext))
|
|
88
|
|
89 (set-alist 'mime-viewer/content-filter-alist
|
|
90 "text/enriched" (function mime-viewer/filter-text/enriched))
|
|
91
|
|
92
|
|
93 ;;; @ end
|
|
94 ;;;
|
|
95
|
|
96 (provide 'tm-rich)
|
|
97
|
|
98 (run-hooks 'tm-rich-load-hook)
|
|
99
|
|
100 ;;; tm-rich.el ends here
|