mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-17 18:37:33 +00:00
Kevin Ryde <user42 at zip.com.au>
(sgml-html-meta-auto-coding-function): Bind `case-fold-search' to t.
This commit is contained in:
parent
09b33024ce
commit
df3c9fe76a
2 changed files with 25 additions and 19 deletions
|
|
@ -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-21 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* textmodes/tex-mode.el (tex-validate-region): Handle escaped parens.
|
||||
|
|
|
|||
|
|
@ -2310,25 +2310,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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue