emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master b2b3159: mm-decode.el: Simplify regexp used to sear


From: Katsumi Yamaoka
Subject: [Emacs-diffs] master b2b3159: mm-decode.el: Simplify regexp used to search html meta tag
Date: Mon, 20 Feb 2017 01:40:38 -0500 (EST)

branch: master
commit b2b31596f807cd593481b75a543b76c9fd76affb
Author: Katsumi Yamaoka <address@hidden>
Commit: Katsumi Yamaoka <address@hidden>

    mm-decode.el: Simplify regexp used to search html meta tag
    
    * lisp/gnus/mm-decode.el (mm-add-meta-html-tag, mm-shr):
    Simplify regexp used to search html meta tag.
---
 lisp/gnus/mm-decode.el | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index becf6d1..5b8aeb3 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -1414,10 +1414,9 @@ Return t if meta tag is added or replaced."
        (goto-char (point-min))
        (if (re-search-forward "\
 <meta\\s-+http-equiv=[\"']?content-type[\"']?\\s-+content=[\"']?\
-text/\\(\\sw+\\)\\(?:;\\s-*charset=\\([^\t\n\r \"'>]+\\)\\)?[^>]*>" nil t)
+text/html\\(?:;\\s-*charset=\\([^\t\n\r \"'>]+\\)\\)?[^>]*>" nil t)
            (if (and (not force-charset)
-                    (match-beginning 2)
-                    (string-match "\\`html\\'" (match-string 1)))
+                    (match-beginning 1))
                ;; Don't modify existing meta tag.
                nil
              ;; Replace it with the one specifying charset.
@@ -1796,18 +1795,16 @@ If RECURSIVE, search recursively."
        charset coding char document)
     (mm-with-part (or handle (setq handle (mm-dissect-buffer t)))
       (setq case-fold-search t)
-      (setq charset
-           (or (mail-content-type-get (mm-handle-type handle) 'charset)
-               (progn
-                 (goto-char (point-min))
-                 (and (re-search-forward "\
+      (or (setq charset
+               (mail-content-type-get (mm-handle-type handle) 'charset))
+         (progn
+           (goto-char (point-min))
+           (and (re-search-forward "\
 <meta\\s-+http-equiv=[\"']?content-type[\"']?\\s-+content=[\"']?\
-text/\\(\\sw+\\)\\(?:;\\s-*charset=\\([^\t\n\r \"'>]+\\)\\)?[^>]*>" nil t)
-                      (setq coding
-                            (mm-charset-to-coding-system (match-string 2)
-                                                         nil t))
-                      (string-match "\\`html\\'" (match-string 1))))
-               mail-parse-charset))
+text/html;\\s-*charset=\\([^\t\n\r \"'>]+\\)[^>]*>" nil t)
+                (setq coding (mm-charset-to-coding-system (match-string 1)
+                                                          nil t))))
+         (setq charset mail-parse-charset))
       (when (and (or coding
                     (setq coding (mm-charset-to-coding-system charset nil t)))
                 (not (eq coding 'ascii)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]