Kevin Ryde <user42 at zip.com.au>

(sgml-html-meta-auto-coding-function): Bind `case-fold-search' to t.
This commit is contained in:
Glenn Morris 2007-09-21 03:21:39 +00:00
parent 41a633fff6
commit ef44317c7c
3 changed files with 28 additions and 19 deletions

View file

@ -87,6 +87,9 @@ http://lists.gnu.org/archive/html/bug-gnu-emacs/2007-09/msg00020.html
** Bug/Patch view.el
http://lists.gnu.org/archive/html/bug-gnu-emacs/2007-09/msg00073.html
** ses-mode runs unsafe functions even if you say "n" when prompted
http://lists.gnu.org/archive/html/bug-gnu-emacs/2007-09/msg00109.html
* FIXES FOR EMACS 22.3
Here we list any small fixes that arrived too late for Emacs 22.2, but

View file

@ -1,3 +1,8 @@
2007-09-21 Kevin Ryde <user42@zip.com.au>
* international/mule.el (sgml-html-meta-auto-coding-function):
Bind `case-fold-search' to t.
2007-09-20 Stefan Monnier <monnier@iro.umontreal.ca>
* wid-edit.el (widget-image-insert): Don't merge mouse-face with

View file

@ -2302,25 +2302,26 @@ This function is intended to be added to `auto-coding-functions'."
(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)