[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 3faa508eba: Make mailcap consistent about regexp-quoting minors
From: |
Lars Ingebrigtsen |
Subject: |
master 3faa508eba: Make mailcap consistent about regexp-quoting minors |
Date: |
Sat, 1 Oct 2022 09:20:57 -0400 (EDT) |
branch: master
commit 3faa508eba84a1983732099cbd3cc1eaad404158
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
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.
---
lisp/net/mailcap.el | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el
index a5f589459b..b678df30bd 100644
--- a/lisp/net/mailcap.el
+++ b/lisp/net/mailcap.el
@@ -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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 3faa508eba: Make mailcap consistent about regexp-quoting minors,
Lars Ingebrigtsen <=