Variable: mailcap-mime-data

mailcap-mime-data is a variable defined in mailcap.el.gz.

Value

Large value
(("application"
  ("vnd\\.ms-excel" (viewer . "gnumeric %s") (test getenv "DISPLAY")
   (type . "application/vnd\\.ms-excel"))
  ("octet-stream" (viewer . mailcap-save-binary-file) (non-viewer . t)
   (type . "application/octet-stream"))
  ("dvi" (viewer . "xdvi -safer %s") (test eq window-system 'x)
   ("needsx11") (type . "application/dvi") ("print" . "dvips -qRP %s"))
  ("dvi" (viewer . "dvitty %s") (test not (getenv "DISPLAY"))
   (type . "application/dvi") ("print" . "dvips -qRP %s"))
  ("emacs-lisp" (viewer . mailcap-maybe-eval)
   (type . "application/emacs-lisp"))
  ("x-emacs-lisp" (viewer . mailcap-maybe-eval)
   (type . "application/x-emacs-lisp"))
  ("x-tar" (viewer . mailcap-save-binary-file) (non-viewer . t)
   (type . "application/x-tar"))
  ("x-latex" (viewer . tex-mode) (type . "application/x-latex"))
  ("x-tex" (viewer . tex-mode) (type . "application/x-tex"))
  ("latex" (viewer . tex-mode) (type . "application/latex"))
  ("tex" (viewer . tex-mode) (type . "application/tex"))
  ("texinfo" (viewer . texinfo-mode) (type . "application/tex"))
  ("zip" (viewer . mailcap-save-binary-file) (non-viewer . t)
   (type . "application/zip") ("copiousoutput"))
  ("pdf" (viewer . doc-view-mode) (type . "application/pdf")
   (test . window-system))
  ("pdf" (viewer . pdf-view-mode) (type . "application/pdf")
   (test . window-system))
  ("pdf" (viewer . "gv -safer %s") (type . "application/pdf")
   (test . window-system) ("print" . "pdf2ps %s - | lpr"))
  ("pdf" (viewer . "gpdf %s") (type . "application/pdf")
   ("print" . "pdftops %s - | lpr") (test eq window-system 'x))
  ("pdf" (viewer . "xpdf %s") (type . "application/pdf")
   ("print" . "pdftops %s - | lpr") (test eq window-system 'x))
  ("pdf" (viewer . "pdftotext %s -") (type . "application/pdf")
   ("print" . "pdftops %s - | lpr") ("copiousoutput"))
  ("postscript" (viewer . "gv -safer %s")
   (type . "application/postscript") (test . window-system)
   ("print" . "lpr %s") ("needsx11"))
  ("postscript" (viewer . "ghostview -dSAFER %s")
   (type . "application/postscript") (test eq window-system 'x)
   ("print" . "lpr %s") ("needsx11"))
  ("postscript" (viewer . "ps2ascii %s")
   (type . "application/postscript") (test not (getenv "DISPLAY"))
   ("print" . "lpr %s") ("copiousoutput"))
  ("sieve" (viewer . sieve-mode) (type . "application/sieve"))
  ("pgp-keys" (viewer . "gpg --import --interactive --verbose")
   (type . "application/pgp-keys") ("needsterminal")))
 ("audio" ("x-mpeg" (viewer . "maplay %s") (type . "audio/x-mpeg"))
  (".*" (viewer . "showaudio") (type . "audio/*")))
 ("message"
  ("rfc-*822" (viewer . mm-view-message)
   (test and (featurep 'gnus) (gnus-alive-p))
   (type . "message/rfc822"))
  ("rfc-*822" (viewer . vm-mode) (type . "message/rfc822"))
  ("rfc-*822" (viewer . view-mode) (type . "message/rfc822")))
 ("image"
  ("x-xwd" (viewer . "xwud -in %s") (type . "image/x-xwd")
   ("compose" . "xwd -frame > %s") (test eq window-system 'x)
   ("needsx11"))
  ("x11-dump" (viewer . "xwud -in %s") (type . "image/x-xwd")
   ("compose" . "xwd -frame > %s") (test eq window-system 'x)
   ("needsx11"))
  ("windowdump" (viewer . "xwud -in %s") (type . "image/x-xwd")
   ("compose" . "xwd -frame > %s") (test eq window-system 'x)
   ("needsx11"))
  (".*" (viewer . "display %s") (type . "image/*")
   (test eq window-system 'x) ("needsx11")))
 ("text" ("plain" (viewer . view-mode) (type . "text/plain"))
  ("plain" (viewer . fundamental-mode) (type . "text/plain"))
  ("enriched" (viewer . enriched-decode) (type . "text/enriched"))
  ("dns" (viewer . dns-mode) (type . "text/dns")))
 ("video"
  ("mpeg" (viewer . "mpeg_play %s") (type . "video/mpeg")
   (test eq window-system 'x) ("needsx11")))
 ("x-world"
  ("x-vrml" (viewer . "webspace -remote %s -URL %u")
   (type . "x-world/x-vrml") ("description" "VRML document")))
 ("archive" ("tar" (viewer . tar-mode) (type . "archive/tar"))))

Documentation

The mailcap structure is an assoc list of assoc lists.

1st assoc list is keyed on the major content-type
2nd assoc list is keyed on the minor content-type (which can be a regexp)

Which looks like:
-----------------
 (("application"
   ("postscript" . <info>))
  ("text"
   ("plain" . <info>)))

Where <info> is another assoc list of the various information related to the mailcap RFC 1524. This is keyed on the lowercase attribute name (viewer, test, etc). This looks like:
 ((viewer . VIEWERINFO)
  (test . TESTINFO)
  (xxxx . "STRING")
  FLAG)

Where VIEWERINFO specifies how the content-type is viewed. Can be a string, in which case it is run through a shell, with appropriate parameters, or a symbol, in which case the symbol must name a function of zero arguments which is called in a buffer holding the MIME part's content.

TESTINFO is a test for the viewer's applicability, or nil. If nil, it means the viewer is always valid. If it is a Lisp function, it is called with a list of items from any extra fields from the Content-Type header as argument to return a boolean value for the validity. Otherwise, if it is a non-function Lisp symbol or list whose car is a symbol, it is evaluated to yield the validity. If it is a string or list of strings, it represents a shell command to run to return a true or false shell value for the validity.

The last matching entry in this structure takes precedence over preceding entries.

Probably introduced at or before Emacs version 25.1.

Source Code

;; Defined in /usr/src/emacs/lisp/net/mailcap.el.gz
;; 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"))
     ("octet-stream"
      (viewer . mailcap-save-binary-file)
      (non-viewer . t)
      (type . "application/octet-stream"))
     ("dvi"
      (viewer . "xdvi -safer %s")
      (test   . (eq window-system 'x))
      ("needsx11")
      (type   . "application/dvi")
      ("print" . "dvips -qRP %s"))
     ("dvi"
      (viewer . "dvitty %s")
      (test   . (not (getenv "DISPLAY")))
      (type   . "application/dvi")
      ("print" . "dvips -qRP %s"))
     ("emacs-lisp"
      (viewer . mailcap-maybe-eval)
      (type   . "application/emacs-lisp"))
     ("x-emacs-lisp"
      (viewer . mailcap-maybe-eval)
      (type   . "application/x-emacs-lisp"))
     ("x-tar"
      (viewer . mailcap-save-binary-file)
      (non-viewer . t)
      (type   . "application/x-tar"))
     ("x-latex"
      (viewer . tex-mode)
      (type   . "application/x-latex"))
     ("x-tex"
      (viewer . tex-mode)
      (type   . "application/x-tex"))
     ("latex"
      (viewer . tex-mode)
      (type   . "application/latex"))
     ("tex"
      (viewer . tex-mode)
      (type   . "application/tex"))
     ("texinfo"
      (viewer . texinfo-mode)
      (type   . "application/tex"))
     ("zip"
      (viewer . mailcap-save-binary-file)
      (non-viewer . t)
      (type   . "application/zip")
      ("copiousoutput"))
     ("pdf"
      (viewer . doc-view-mode)
      (type . "application/pdf")
      (test . window-system))
     ("pdf"
      (viewer . pdf-view-mode)
      (type . "application/pdf")
      (test . window-system))
     ("pdf"
      (viewer . "gv -safer %s")
      (type . "application/pdf")
      (test . window-system)
      ("print" . ,(concat "pdf2ps %s - | " mailcap-print-command)))
     ("pdf"
      (viewer . "gpdf %s")
      (type . "application/pdf")
      ("print" . ,(concat "pdftops %s - | " mailcap-print-command))
      (test . (eq window-system 'x)))
     ("pdf"
      (viewer . "xpdf %s")
      (type . "application/pdf")
      ("print" . ,(concat "pdftops %s - | " mailcap-print-command))
      (test . (eq window-system 'x)))
     ("pdf"
      (viewer . ,(concat "pdftotext %s -"))
      (type   . "application/pdf")
      ("print" . ,(concat "pdftops %s - | " mailcap-print-command))
      ("copiousoutput"))
     ("postscript"
      (viewer . "gv -safer %s")
      (type . "application/postscript")
      (test   . window-system)
      ("print" . ,(concat mailcap-print-command " %s"))
      ("needsx11"))
     ("postscript"
      (viewer . "ghostview -dSAFER %s")
      (type . "application/postscript")
      (test   . (eq window-system 'x))
      ("print" . ,(concat mailcap-print-command " %s"))
      ("needsx11"))
     ("postscript"
      (viewer . "ps2ascii %s")
      (type . "application/postscript")
      (test . (not (getenv "DISPLAY")))
      ("print" . ,(concat mailcap-print-command " %s"))
      ("copiousoutput"))
     ("sieve"
      (viewer . sieve-mode)
      (type   . "application/sieve"))
     ("pgp-keys"
      (viewer . "gpg --import --interactive --verbose")
      (type   . "application/pgp-keys")
      ("needsterminal")))
    ("audio"
     ("x-mpeg"
      (viewer . "maplay %s")
      (type   . "audio/x-mpeg"))
     (".*"
      (viewer . "showaudio")
      (type   . "audio/*")))
    ("message"
     ("rfc-*822"
      (viewer . mm-view-message)
      (test   . (and (featurep 'gnus)
		     (gnus-alive-p)))
      (type   . "message/rfc822"))
     ("rfc-*822"
      (viewer . vm-mode)
      (type   . "message/rfc822"))
     ("rfc-*822"
      (viewer . view-mode)
      (type   . "message/rfc822")))
    ("image"
     ("x-xwd"
      (viewer  . "xwud -in %s")
      (type    . "image/x-xwd")
      ("compose" . "xwd -frame > %s")
      (test    . (eq window-system 'x))
      ("needsx11"))
     ("x11-dump"
      (viewer . "xwud -in %s")
      (type . "image/x-xwd")
      ("compose" . "xwd -frame > %s")
      (test   . (eq window-system 'x))
      ("needsx11"))
     ("windowdump"
      (viewer . "xwud -in %s")
      (type . "image/x-xwd")
      ("compose" . "xwd -frame > %s")
      (test   . (eq window-system 'x))
      ("needsx11"))
     (".*"
      (viewer . "display %s")
      (type . "image/*")
      (test   . (eq window-system 'x))
      ("needsx11")))
    ("text"
     ("plain"
      (viewer  . view-mode)
      (type    . "text/plain"))
     ("plain"
      (viewer  . fundamental-mode)
      (type    . "text/plain"))
     ("enriched"
      (viewer . enriched-decode)
      (type   . "text/enriched"))
     ("dns"
      (viewer . dns-mode)
      (type   . "text/dns")))
    ("video"
     ("mpeg"
      (viewer . "mpeg_play %s")
      (type   . "video/mpeg")
      (test   . (eq window-system 'x))
      ("needsx11")))
    ("x-world"
     ("x-vrml"
      (viewer  . "webspace -remote %s -URL %u")
      (type    . "x-world/x-vrml")
      ("description"
       "VRML document")))
    ("archive"
     ("tar"
      (viewer . tar-mode)
      (type . "archive/tar"))))
  "The mailcap structure is an assoc list of assoc lists.
1st assoc list is keyed on the major content-type
2nd assoc list is keyed on the minor content-type (which can be a regexp)

Which looks like:
-----------------
 ((\"application\"
   (\"postscript\" . <info>))
  (\"text\"
   (\"plain\" . <info>)))

Where <info> is another assoc list of the various information
related to the mailcap RFC 1524.  This is keyed on the lowercase
attribute name (viewer, test, etc).  This looks like:
 ((viewer . VIEWERINFO)
  (test   . TESTINFO)
  (xxxx   . \"STRING\")
  FLAG)

Where VIEWERINFO specifies how the content-type is viewed.  Can be
a string, in which case it is run through a shell, with appropriate
parameters, or a symbol, in which case the symbol must name a function
of zero arguments which is called in a buffer holding the MIME part's
content.

TESTINFO is a test for the viewer's applicability, or nil.  If nil, it
means the viewer is always valid.  If it is a Lisp function, it is
called with a list of items from any extra fields from the
Content-Type header as argument to return a boolean value for the
validity.  Otherwise, if it is a non-function Lisp symbol or list
whose car is a symbol, it is `eval'uated to yield the validity.  If it
is a string or list of strings, it represents a shell command to run
to return a true or false shell value for the validity.

The last matching entry in this structure takes precedence over
preceding entries.")