mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-17 01:34:21 +00:00
Make mailcap consistent about regexp-quoting minors
* lisp/net/mailcap.el (mailcap-mime-data): Quote regexp. (mailcap-mime-extensions): Ditto. (mailcap--regexp-quote-type): New function. (mailcap-parse-mimetype-file): Use it to get consistent quoting of (regexp) strings (bug#52038). Before you'd get both application/vnd\.ms-excel and application/vnd.ms-excel (etc), making prompting confusing.
This commit is contained in:
parent
41234a21bf
commit
3faa508eba
1 changed files with 8 additions and 3 deletions
|
|
@ -125,7 +125,7 @@ is consulted."
|
|||
("vnd\\.ms-excel"
|
||||
(viewer . "gnumeric %s")
|
||||
(test . (getenv "DISPLAY"))
|
||||
(type . "application/vnd.ms-excel"))
|
||||
(type . "application/vnd\\.ms-excel"))
|
||||
("octet-stream"
|
||||
(viewer . mailcap-save-binary-file)
|
||||
(non-viewer . t)
|
||||
|
|
@ -979,7 +979,7 @@ If NO-DECODE is non-nil, don't decode STRING."
|
|||
(".vox" . "audio/basic")
|
||||
(".vrml" . "x-world/x-vrml")
|
||||
(".wav" . "audio/x-wav")
|
||||
(".xls" . "application/vnd.ms-excel")
|
||||
(".xls" . "application/vnd\\.ms-excel")
|
||||
(".wrl" . "x-world/x-vrml")
|
||||
(".xbm" . "image/xbm")
|
||||
(".xpm" . "image/xpm")
|
||||
|
|
@ -1051,7 +1051,8 @@ If FORCE, re-parse even if already parsed."
|
|||
(setq save-pos (point))
|
||||
(skip-chars-forward "^ \t\n")
|
||||
(downcase-region save-pos (point))
|
||||
(setq type (buffer-substring save-pos (point)))
|
||||
(setq type (mailcap--regexp-quote-type
|
||||
(buffer-substring save-pos (point))))
|
||||
(while (not (eolp))
|
||||
(skip-chars-forward " \t")
|
||||
(setq save-pos (point))
|
||||
|
|
@ -1064,6 +1065,10 @@ If FORCE, re-parse even if already parsed."
|
|||
(setq mailcap-mime-extensions (append extns mailcap-mime-extensions)
|
||||
extns nil)))))
|
||||
|
||||
(defun mailcap--regexp-quote-type (type)
|
||||
(pcase-let ((`(,major ,minor) (split-string type "/")))
|
||||
(concat major "/" (regexp-quote minor))))
|
||||
|
||||
(defun mailcap-extension-to-mime (extn)
|
||||
"Return the MIME content type of the file extensions EXTN."
|
||||
(mailcap-parse-mimetypes)
|
||||
|
|
|
|||
Loading…
Reference in a new issue