From 811cab86513cacca3cba5a27ca4ac0621ed28c5d Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 11 Nov 2004 21:42:32 +0000 Subject: [PATCH] (magic-mode-alist): Use optimization for SGML mode too. (set-auto-mode): Doc fix. Remove unused variable `xml'. --- lisp/files.el | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index a9a63019997..ad77688b6bc 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1876,7 +1876,9 @@ with that interpreter in `interpreter-mode-alist'.") "[Hh][Tt][Mm][Ll]")) . html-mode) ;; These two must come after html, because they are more general: ("<\\?xml " . xml-mode) - ("\\s *<\\(?:!--\\(?:.\\|\n\\)*?-->\\s *<\\)*!DOCTYPE " . sgml-mode) + (,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)") + (comment-re (concat "\\(?:!--" incomment-re "*-->\\s *<\\)"))) + (concat "\\s *<" comment-re "*!DOCTYPE ")) . sgml-mode) ("%![^V]" . ps-mode) ("# xmcd " . conf-unix-mode)) "Alist of buffer beginnings vs. corresponding major mode functions. @@ -1888,9 +1890,8 @@ called, unless it is nil (to allow `auto-mode-alist' to override).") This checks for a -*- mode tag in the buffer's text, checks the interpreter that runs this file against `interpreter-mode-alist', -compares the buffer beginning against `magic-mode-alist', -or compares the filename against the entries in -`auto-mode-alist'. +compares the buffer beginning against `magic-mode-alist', or +compares the filename against the entries in `auto-mode-alist'. It does not check for the `mode:' local variable in the Local Variables section of the file; for that, use `hack-local-variables'. @@ -1901,13 +1902,11 @@ If `enable-local-variables' is nil, this function does not check for a If the optional argument KEEP-MODE-IF-SAME is non-nil, then we only set the major mode, if that would change it." ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*- - (let (end done mode modes xml) + (let (end done mode modes) ;; Find a -*- mode tag (save-excursion (goto-char (point-min)) (skip-chars-forward " \t\n") - ;; While we're at this point, check xml for later. - (setq xml (looking-at "<\\?xml \\|