]> git.eshelyaron.com Git - emacs.git/commitdiff
(sgml-html-meta-auto-coding-function): Ensure that the buffer contains a
authorRomain Francoise <romain@orebokech.com>
Fri, 5 Jan 2007 17:58:02 +0000 (17:58 +0000)
committerRomain Francoise <romain@orebokech.com>
Fri, 5 Jan 2007 17:58:02 +0000 (17:58 +0000)
HTML document.

lisp/ChangeLog
lisp/international/mule.el

index 378e5388ecb5a4341e3b355a657a39d43264e220..68aee396f48407a5f70ef8ed36f8528b5b437e50 100644 (file)
@@ -1,6 +1,11 @@
+2007-01-05  Romain Francoise  <romain@orebokech.com>
+
+       * international/mule.el (sgml-html-meta-auto-coding-function):
+       Ensure that the buffer contains a HTML document.
+
 2007-01-05  Dan Nicolaescu  <dann@ics.uci.edu>
 
-       * faces.el (momentary): Move here ... 
+       * faces.el (momentary): Move here ...
        * subr.el (momentary): ... from here.
 
 2007-01-05  Nick Roberts  <nickrob@snap.net.nz>
@@ -11,9 +16,9 @@
 
 2007-01-04  Juanma Barranquero  <lekktu@gmail.com>
 
-       * files.el (find-file-noselect-1, set-visited-file-name): 
+       * files.el (find-file-noselect-1, set-visited-file-name):
        Allow backup-enable-predicate to be nil.
-       
+
 2007-01-04  Kevin Rodgers  <kevin.d.rodgers@gmail.com>
 
        * subr.el (momentary): New face.
index ddaacfe72164209a193a82b00cd2e759d42fd075..954146453edf42b6b30b630744c87459cae4e0d4 100644 (file)
@@ -2292,7 +2292,12 @@ This function is intended to be added to `auto-coding-functions'."
                        ;; 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)