Function: mh-minibuffer-read-type

mh-minibuffer-read-type is a byte-compiled function defined in mh-mime.el.gz.

Signature

(mh-minibuffer-read-type FILENAME &optional DEFAULT)

Documentation

Return the content type associated with the given FILENAME.

If the "file" command exists and recognizes the given file, then its value is returned; otherwise, the user is prompted for a type (see mailcap-mime-types). Optional argument DEFAULT is returned if a type isn't entered.

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-mime.el.gz
(defun mh-minibuffer-read-type (filename &optional default)
  "Return the content type associated with the given FILENAME.
If the \"file\" command exists and recognizes the given file,
then its value is returned; otherwise, the user is prompted for
a type (see `mailcap-mime-types').
Optional argument DEFAULT is returned if a type isn't entered."
  (mailcap-parse-mimetypes)
  (let* ((default (or default
                      (mm-default-file-type filename)
                      "application/octet-stream"))
         (probed-type (mh-file-mime-type filename))
         (type (or (and (not (equal probed-type "application/octet-stream"))
                        probed-type)
                   (completing-read
                    (format-prompt "Content type" default)
                    (mapcar #'list (mailcap-mime-types))))))
    (if (not (equal type ""))
        type
      default)))