diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2021-11-06 21:14:54 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-11-06 21:59:27 +0100 |
commit | 5a4f98b0b6d503b1ce68bb29937a84acf3ef97da (patch) | |
tree | e5851c2b9bbc9ac1f68141fc288a71ef74516e76 | |
parent | a43ec2e7a33ed7a5d4ff703171bc1c58d0ee0bea (diff) | |
download | emacs-5a4f98b0b6d503b1ce68bb29937a84acf3ef97da.tar.gz emacs-5a4f98b0b6d503b1ce68bb29937a84acf3ef97da.tar.bz2 emacs-5a4f98b0b6d503b1ce68bb29937a84acf3ef97da.zip |
Add new function mailcap-mime-type-to-extension
* lisp/net/mailcap.el (mailcap-mime-type-to-extension): Add a new
helper function to do the reverse of `mailcap-file-name-to-mime-type'.
-rw-r--r-- | lisp/net/mailcap.el | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el index df6bdd1aba5..0ad1a53e846 100644 --- a/lisp/net/mailcap.el +++ b/lisp/net/mailcap.el @@ -1068,6 +1068,14 @@ For instance, \"foo.png\" will result in \"image/png\"." (match-string 1 file-name) ""))) +(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 (cadr (split-string (if (symbolp mime-type) + (symbol-name mime-type) + mime-type) + "/")))) + (defun mailcap-mime-types () "Return a list of MIME media types." (mailcap-parse-mimetypes) |