1 ;;; mailcap.el --- MIME media types configuration
2 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
4 ;; Author: William M. Perry <wmperry@aventail.com>
5 ;; Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; Keywords: news, mail, multimedia
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
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.
27 ;; Provides configuration of MIME media types from directly from Lisp
28 ;; and via the usual mailcap mechanism (RFC 1524). Deals with
29 ;; mime.types similarly.
33 (eval-when-compile (require 'cl))
38 "Definition of viewers for MIME types."
42 (defvar mailcap-parse-args-syntax-table
43 (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table)))
44 (modify-syntax-entry ?' "\"" table)
45 (modify-syntax-entry ?` "\"" table)
46 (modify-syntax-entry ?{ "(" table)
47 (modify-syntax-entry ?} ")" table)
49 "A syntax table for parsing sgml attributes.")
51 ;; Postpone using defcustom for this as it's so big and we essentially
52 ;; have to have two copies of the data around then. Perhaps just
53 ;; customize the Lisp viewers and rely on the normal configuration
54 ;; files for the rest? -- fx
55 (defvar mailcap-mime-data
58 (viewer . "gnumeric %s")
59 (test . (getenv "DISPLAY"))
60 (type . "application/vnd.ms-excel"))
62 (viewer . ssl-view-site-cert)
63 (test . (fboundp 'ssl-view-site-cert))
64 (type . "application/x-x509-ca-cert"))
66 (viewer . ssl-view-user-cert)
67 (test . (fboundp 'ssl-view-user-cert))
68 (type . "application/x-x509-user-cert"))
70 (viewer . mailcap-save-binary-file)
72 (type . "application/octet-stream"))
73 ;;; XEmacs says `ns' device-type not implemented.
75 ;; (viewer . "open %s")
76 ;; (type . "application/dvi")
77 ;; (test . (eq (mm-device-type) 'ns)))
79 (viewer . "xdvi -safer %s")
80 (test . (eq window-system 'x))
82 (type . "application/dvi"))
84 (viewer . "dvitty %s")
85 (test . (not (getenv "DISPLAY")))
86 (type . "application/dvi"))
88 (viewer . mailcap-maybe-eval)
89 (type . "application/emacs-lisp"))
91 (viewer . mailcap-maybe-eval)
92 (type . "application/x-emacs-lisp"))
94 (viewer . mailcap-save-binary-file)
96 (type . "application/x-tar"))
99 (test . (fboundp 'tex-mode))
100 (type . "application/x-latex"))
103 (test . (fboundp 'tex-mode))
104 (type . "application/x-tex"))
107 (test . (fboundp 'tex-mode))
108 (type . "application/latex"))
111 (test . (fboundp 'tex-mode))
112 (type . "application/tex"))
114 (viewer . texinfo-mode)
115 (test . (fboundp 'texinfo-mode))
116 (type . "application/tex"))
118 (viewer . mailcap-save-binary-file)
120 (type . "application/zip")
122 ;; Prefer free viewers.
124 (viewer . "gv -safer %s")
125 (type . "application/pdf")
126 (test . window-system))
129 (type . "application/pdf")
130 (test . (eq window-system 'x)))
132 (viewer . "acroread %s")
133 (type . "application/pdf"))
134 ;;; XEmacs says `ns' device-type not implemented.
136 ;; (viewer . "open %s")
137 ;; (type . "application/postscript")
138 ;; (test . (eq (mm-device-type) 'ns)))
140 (viewer . "gv -safer %s")
141 (type . "application/postscript")
142 (test . window-system)
145 (viewer . "ghostview -dSAFER %s")
146 (type . "application/postscript")
147 (test . (eq window-system 'x))