Mercurial > emacs
diff lisp/international/mule.el @ 75107:1a2349dd4e0b
(sgml-html-meta-auto-coding-function): Ensure that the buffer contains a
HTML document.
author | Romain Francoise <romain@orebokech.com> |
---|---|
date | Fri, 05 Jan 2007 17:58:02 +0000 |
parents | 6ee41fdd69ff |
children | e3694f1cb928 d3099204c799 |
line wrap: on
line diff
--- a/lisp/international/mule.el Fri Jan 05 17:49:43 2007 +0000 +++ b/lisp/international/mule.el Fri Jan 05 17:58:02 2007 +0000 @@ -2292,7 +2292,12 @@ ;; In case of no header, search only 10 lines. (forward-line 10)) (point)))) - (when (re-search-forward "<meta\\s-+http-equiv=[\"']?content-type[\"']?\\s-+content=[\"']text/\\sw+;\\s-*charset=\\(.+?\\)[\"']" size t) + ;; Make sure that the buffer really contains an HTML document, by + ;; checking that it starts with a doctype or a <HTML> start tag + ;; (allowing for whitespace at bob). Note: 'DOCTYPE NETSCAPE' is + ;; useful for Mozilla bookmark files. + (when (and (re-search-forward "\\`[[:space:]\n]*\\(<!doctype[[:space:]\n]+\\(html\\|netscape\\)\\|<html\\)" size t) + (re-search-forward "<meta\\s-+http-equiv=[\"']?content-type[\"']?\\s-+content=[\"']text/\\sw+;\\s-*charset=\\(.+?\\)[\"']" size t)) (let* ((match (match-string 1)) (sym (intern (downcase match)))) (if (coding-system-p sym)