Mercurial > emacs
diff lisp/international/mule.el @ 78853:4e8fc43ecce3
Kevin Ryde <user42 at zip.com.au>
(sgml-html-meta-auto-coding-function): Bind `case-fold-search' to t.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Fri, 21 Sep 2007 03:18:29 +0000 |
parents | 2daf9c28b3a4 |
children | b6fdfff4ae81 |
line wrap: on
line diff
--- a/lisp/international/mule.el Fri Sep 21 03:11:17 2007 +0000 +++ b/lisp/international/mule.el Fri Sep 21 03:18:29 2007 +0000 @@ -2302,25 +2302,26 @@ (defun sgml-html-meta-auto-coding-function (size) "If the buffer has an HTML meta tag, use it to determine encoding. This function is intended to be added to `auto-coding-functions'." - (setq size (min (+ (point) size) - (save-excursion - ;; Limit the search by the end of the HTML header. - (or (search-forward "</head>" size t) - ;; In case of no header, search only 10 lines. - (forward-line 10)) - (point)))) - ;; 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) - sym - (message "Warning: unknown coding system \"%s\"" match) - nil)))) + (let ((case-fold-search t)) + (setq size (min (+ (point) size) + (save-excursion + ;; Limit the search by the end of the HTML header. + (or (search-forward "</head>" size t) + ;; In case of no header, search only 10 lines. + (forward-line 10)) + (point)))) + ;; 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) + sym + (message "Warning: unknown coding system \"%s\"" match) + nil))))) ;;; (provide 'mule)