tm 7.26.
[elisp/tm.git] / tm-html.el
1 ;;;
2 ;;; tm-html.el: a tm-view internal decoder for HTML
3 ;;;
4 ;;; by MORIOKA Tomohiko <morioka@jaist.ac.jp> (1995/09/14)
5 ;;;
6 ;;; based on tm-latex.el by OKABE Yasuo <okabe@kudpc.kyoto-u.ac.jp>
7 ;;;
8 ;;; $Id: tm-html.el,v 7.1 1995/11/16 15:43:34 morioka Exp $
9 ;;;
10
11 (require 'tm-view)
12
13 (defun mime-article/decode-html (beg end cal)
14   (let* ((cur-buf (current-buffer))
15          new-buf
16          (name (or (cdr (assoc "name" cal))
17                    (cdr (assoc "x-name" cal))
18                    (concat (make-temp-name "tm") ".html")))
19          (encoding (cdr (assoc "encoding" cal)))
20          )
21     (switch-to-buffer mime::article/preview-buffer)
22     (funcall mime/find-file-function (expand-file-name name mime/tmp-dir))
23     (if (or (<= (buffer-size) 0)
24             (y-or-n-p "Replace the existing buffer?"))
25         (progn
26           (erase-buffer)
27           (setq new-buf (current-buffer))
28           (save-excursion
29             (set-buffer cur-buf)
30             (goto-char beg)
31             (re-search-forward "^$")
32             (append-to-buffer new-buf (+ (match-end 0) 1) end)
33             )))
34     (mime/decode-region encoding (point-min)(point-max))
35     (run-hooks 'mime-article/decode-html-hook)
36     ))
37
38 (set-atype 'mime/content-decoding-condition
39            '((type . "text/html")
40              (method . mime-article/decode-html)
41              ))
42
43
44 ;;; @ end
45 ;;;
46
47 (provide 'tm-html)