Function: mailcap-mime-type-to-extension

mailcap-mime-type-to-extension is an autoloaded and byte-compiled function defined in mailcap.el.gz.

Signature

(mailcap-mime-type-to-extension MIME-TYPE)

Documentation

Return a file name extension based on a MIME-TYPE.

For instance, image/png will result in png.

Source Code

;; Defined in /usr/src/emacs/lisp/net/mailcap.el.gz
;;;###autoload
(defun mailcap-mime-type-to-extension (mime-type)
  "Return a file name extension based on a MIME-TYPE.
For instance, `image/png' will result in `png'."
  (intern
   (let ((e (cadr (split-string (if (symbolp mime-type)
                                    (symbol-name mime-type)
                                  mime-type)
                                "/"))))
     ;; Usually, the normal extension is the same as the MIME subtype.
     ;; But for SVG files, the extension is "svg" and the MIME type is
     ;; "svg+xml".
     (if (string= e "svg+xml")
         "svg"
       e))))