comparison 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
comparison
equal deleted inserted replaced
75106:a6b4f9a69719 75107:1a2349dd4e0b
2290 ;; Limit the search by the end of the HTML header. 2290 ;; Limit the search by the end of the HTML header.
2291 (or (search-forward "</head>" size t) 2291 (or (search-forward "</head>" size t)
2292 ;; In case of no header, search only 10 lines. 2292 ;; In case of no header, search only 10 lines.
2293 (forward-line 10)) 2293 (forward-line 10))
2294 (point)))) 2294 (point))))
2295 (when (re-search-forward "<meta\\s-+http-equiv=[\"']?content-type[\"']?\\s-+content=[\"']text/\\sw+;\\s-*charset=\\(.+?\\)[\"']" size t) 2295 ;; Make sure that the buffer really contains an HTML document, by
2296 ;; checking that it starts with a doctype or a <HTML> start tag
2297 ;; (allowing for whitespace at bob). Note: 'DOCTYPE NETSCAPE' is
2298 ;; useful for Mozilla bookmark files.
2299 (when (and (re-search-forward "\\`[[:space:]\n]*\\(<!doctype[[:space:]\n]+\\(html\\|netscape\\)\\|<html\\)" size t)
2300 (re-search-forward "<meta\\s-+http-equiv=[\"']?content-type[\"']?\\s-+content=[\"']text/\\sw+;\\s-*charset=\\(.+?\\)[\"']" size t))
2296 (let* ((match (match-string 1)) 2301 (let* ((match (match-string 1))
2297 (sym (intern (downcase match)))) 2302 (sym (intern (downcase match))))
2298 (if (coding-system-p sym) 2303 (if (coding-system-p sym)
2299 sym 2304 sym
2300 (message "Warning: unknown coding system \"%s\"" match) 2305 (message "Warning: unknown coding system \"%s\"" match)