2 ;;; tm-w3.el: a tm-view internal decoder for HTML
4 ;;; by MORIOKA Tomohiko <morioka@jaist.ac.jp> (1995/09/14)
6 ;;; based on tm-latex.el by OKABE Yasuo <okabe@kudpc.kyoto-u.ac.jp>
8 ;;; $Id: tm-w3.el,v 2.0 1995/10/19 07:57:57 morioka Exp $
13 (autoload 'w3-mode "w3" "HTML viewer" t)
15 (defvar mime-viewer/html-default-mode (function w3-mode))
17 (defun mime-viewer/decode-html (beg end cal)
18 (let* ((cur-buf (current-buffer))
20 (name (or (cdr (assoc "name" cal))
21 (cdr (assoc "x-name" cal))
22 (concat (make-temp-name "tm") ".html"))))
23 (switch-to-buffer mime::article/preview-buffer)
24 (funcall mime/find-file-function (expand-file-name name mime/tmp-dir))
25 (if (or (<= (buffer-size) 0)
26 (y-or-n-p "Replace the existing buffer?"))
29 (setq new-buf (current-buffer))
33 (re-search-forward "^$")
34 (append-to-buffer new-buf (+ (match-end 0) 1) end)
36 (cond ((string= encoding "quoted-printable")
37 (quoted-printable-decode-region (point-min)(point-max))
39 ((string= encoding "base64")
40 (base64-decode-region (point-min)(point-max))
42 (call-interactively mime-viewer/html-default-mode)
45 (set-atype 'mime/content-decoding-condition
46 '((type . "text/html")
47 (method . mime-viewer/decode-html)