2001-07-15 Pavel Jan\e,Bm\e(Bk <Pavel@Janik.cz>
[gnus] / lisp / mailcap.el
index 56eb75c..bcfd238 100644 (file)
@@ -1,9 +1,9 @@
-;;; mailcap.el --- Functions for displaying MIME parts
-;; Copyright (C) 1998-2000 Free Software Foundation, Inc.
+;;; mailcap.el --- MIME media types configuration
+;; Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 
 ;; Author: William M. Perry <wmperry@aventail.com>
 ;;     Lars Magne Ingebrigtsen <larsi@gnus.org>
-;; Keywords: news, mail
+;; Keywords: news, mail, multimedia
 
 ;; This file is part of GNU Emacs.
 
 
 ;;; Commentary:
 
+;; Provides configuration of MIME media types from directly from Lisp
+;; and via the usual mailcap mechanism (RFC 1524).  Deals with
+;; mime.types similarly.
+
 ;;; Code:
 
 (eval-when-compile (require 'cl))
 (require 'mail-parse)
 (require 'mm-util)
 
+(defgroup mailcap nil
+  "Definition of viewers for MIME types."
+  :version "21.1"
+  :group 'mime)
+
 (defvar mailcap-parse-args-syntax-table
   (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table)))
     (modify-syntax-entry ?' "\"" table)
     table)
   "A syntax table for parsing sgml attributes.")
 
+;; Postpone using defcustom for this as it's so big and we essentially
+;; have to have two copies of the data around then.  Perhaps just
+;; customize the Lisp viewers and rely on the normal configuration
+;; files for the rest?  -- fx
 (defvar mailcap-mime-data
   '(("application"
+     ("vnd.ms-excel"
+      (viewer . "gnumeric %s")
+      (test   . (getenv "DISPLAY"))
+      (type . "application/vnd.ms-excel"))
      ("x-x509-ca-cert"
       (viewer . ssl-view-site-cert)
       (test . (fboundp 'ssl-view-site-cert))
      ("octet-stream"
       (viewer . mailcap-save-binary-file)
       (non-viewer . t)
-      (type ."application/octet-stream"))
-     ("dvi"
-      (viewer . "open %s")
-      (type   . "application/dvi")
-      (test   . (eq (mm-device-type) 'ns)))
+      (type . "application/octet-stream"))
+;;; XEmacs says `ns' device-type not implemented.
+;;      ("dvi"
+;;       (viewer . "open %s")
+;;       (type   . "application/dvi")
+;;       (test   . (eq (mm-device-type) 'ns)))
      ("dvi"
       (viewer . "xdvi %s")
       (test   . (eq (mm-device-type) 'x))
       (non-viewer . t)
       (type   . "application/zip")
       ("copiousoutput"))
+     ;; Prefer free viewers.
+     ("pdf"
+      (viewer . "gv %s")
+      (type . "application/pdf")
+      (test . window-system))
+     ("pdf"
+      (viewer . "xpdf %s")
+      (type . "application/pdf")
+      (test . (eq (mm-device-type) 'x)))
      ("pdf"
       (viewer . "acroread %s")
       (type   . "application/pdf"))
+;;; XEmacs says `ns' device-type not implemented.
+;;      ("postscript"
+;;       (viewer . "open %s")
+;;       (type   . "application/postscript")
+;;       (test   . (eq (mm-device-type) 'ns)))
      ("postscript"
-      (viewer . "open %s")
-      (type   . "application/postscript")
-      (test   . (eq (mm-device-type) 'ns)))
+      (viewer . "gv -safer %s")
+      (type . "application/postscript")
+      (test   . window-system)
+      ("needsx11"))
      ("postscript"
       (viewer . "ghostview -dSAFER %s")
       (type . "application/postscript")
       (viewer . "ps2ascii %s")
       (type . "application/postscript")
       (test . (not (getenv "DISPLAY")))
-      ("copiousoutput")))
+      ("copiousoutput"))
+     ("sieve"
+      (viewer . sieve-mode)
+      (test   . (fboundp 'sieve-mode))
+      (type   . "application/sieve")))
     ("audio"
      ("x-mpeg"
  &