This commit was generated by cvs2svn to compensate for changes in r533,
[elisp/tm.git] / tm-latex.el
1 ;;;
2 ;;; tm-latex: tm-view internal decoder for LaTeX
3 ;;;
4 ;;; by OKABE Yasuo <okabe@kudpc.kyoto-u.ac.jp> (1994/11/11)
5 ;;;
6 ;;; modified by MORIOKA Tomohiko <morioka@jaist.ac.jp>
7 ;;;
8 ;;; $Id: tm-latex.el,v 3.0 1995/09/14 15:51:35 morioka Exp $
9 ;;;
10
11 (require 'tm-view)
12
13 (defun mime/decode-text/latex (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") ".tex"))))
19     (switch-to-buffer mime::article/preview-buffer)
20     (funcall mime/find-file-function (expand-file-name name mime/tmp-dir))
21     (if (or (<= (buffer-size) 0)
22             (y-or-n-p "Replace the existing buffer?"))
23         (progn
24           (erase-buffer)
25           (setq new-buf (current-buffer))
26           (save-excursion
27             (set-buffer cur-buf)
28             (goto-char beg)
29             (re-search-forward "^$")
30             (append-to-buffer new-buf (+ (match-end 0) 1) end)
31             )))
32     ))
33
34 (set-atype 'mime/content-decoding-condition
35            '((type . "text/x-latex")
36              (method . mime/decode-text/latex)
37              ))
38
39 (set-atype 'mime/content-decoding-condition
40            '((type . "application/x-latex")
41              (method . mime/decode-text/latex)
42              ))
43
44 ;(set-atype 'mime/content-decoding-condition
45 ;          '((type . "application/octet-stream")
46 ;            ("type" . "latex")
47 ;            (method . mime/decode-text/latex)
48 ;            ))
49
50 (provide 'tm-latex)