Function: mailcap-parse-mimetype-file
mailcap-parse-mimetype-file is a byte-compiled function defined in
mailcap.el.gz.
Signature
(mailcap-parse-mimetype-file FNAME)
Documentation
Parse out a mime-types file FNAME.
Source Code
;; Defined in /usr/src/emacs/lisp/net/mailcap.el.gz
(defun mailcap-parse-mimetype-file (fname)
"Parse out a mime-types file FNAME."
(let (type ; The MIME type for this line
extns ; The extensions for this line
save-pos ; Misc. saved buffer positions
save-extn)
(with-temp-buffer
(insert-file-contents fname)
(mailcap-replace-regexp "#.*" "")
(mailcap-replace-regexp "\n+" "\n")
(mailcap-replace-regexp "[ \t]+$" "")
(goto-char (point-max))
(skip-chars-backward " \t\n")
(delete-region (point) (point-max))
(goto-char (point-min))
(while (not (eobp))
(skip-chars-forward " \t\n")
(setq save-pos (point))
(skip-chars-forward "^ \t\n")
(downcase-region save-pos (point))
(setq type (buffer-substring save-pos (point)))
(while (not (eolp))
(skip-chars-forward " \t")
(setq save-pos (point))
(skip-chars-forward "^ \t\n")
(setq save-extn (buffer-substring save-pos (point)))
(push (cons (if (= (string-to-char save-extn) ?.)
save-extn (concat "." save-extn))
type)
extns))
(setq mailcap-mime-extensions (append extns mailcap-mime-extensions)
extns nil)))))