From: Stefan Monnier Date: Thu, 11 Nov 2004 04:52:27 +0000 (+0000) Subject: (magic-mode-alist): Reduce backtracking in the HTML regexp. X-Git-Tag: ttn-vms-21-2-B4~4014 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=32a0479a9d9bffd3c1a8e29b5e682669ce38073a;p=emacs.git (magic-mode-alist): Reduce backtracking in the HTML regexp. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c6587f7d5ea..3d0d67102da 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2004-11-10 Stefan Monnier + * files.el (magic-mode-alist): Reduce backtracking in the HTML regexp. + * textmodes/sgml-mode.el (sgml-tag-text-p): New fun. (sgml-parse-tag-backward): Use it to skip spurious < or >. @@ -11,8 +13,7 @@ 2004-11-10 Nick Roberts * tooltip.el: Don't require cl, comint, gud, gdb-ui for - compilation. The resulting compiler warnings appear to be - harmless. + compilation. The resulting compiler warnings appear to be harmless. 2004-11-10 Daniel Pfeiffer @@ -69,7 +70,7 @@ (diary-from-outlook-gnus, diary-from-outlook-rmail): Do not use interactive-p; but rather new optional argument NOCONFIRM. -2004-11-09 Stefan +2004-11-09 Stefan Monnier * emacs-lisp/easymenu.el (easy-menu-intern): Revert to no-downcasing. (easy-menu-name-match): Revert correspondingly. @@ -232,7 +233,7 @@ * emacs-lisp/easymenu.el (easy-menu-get-map): Fix last change. -2004-11-06 Stefan +2004-11-06 Stefan Monnier * emacs-lisp/easymenu.el (easy-menu-get-map-look-for-name): Remove. (easy-menu-lookup-name): New fun to replace it. diff --git a/lisp/files.el b/lisp/files.el index bfbf0cf39d0..a9a63019997 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1866,10 +1866,14 @@ regular expression. The mode is then determined as the mode associated with that interpreter in `interpreter-mode-alist'.") (defvar magic-mode-alist - '(;; The < comes before the groups (but the first) to reduce backtracking. - ;; Is there a nicer way of getting . including \n like Perl's //s? + `(;; The < comes before the groups (but the first) to reduce backtracking. ;; TODO: UTF-16 ]*>\\)?\\s *<\\(?:!--\\(?:.\\|\n\\)*?-->\\s *<\\)*\\(?:!DOCTYPE\\s +[^>]*>\\s *<\\)?\\s *\\(?:!--\\(?:.\\|\n\\)*?-->\\s *<\\)*[Hh][Tt][Mm][Ll]" . html-mode) + (,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)") + (comment-re (concat "\\(?:!--" incomment-re "*-->\\s *<\\)"))) + (concat "\\(?:<\\?xml\\s +[^>]*>\\)?\\s *<" + comment-re "*" + "\\(?:!DOCTYPE\\s +[^>]*>\\s *<\\s *" comment-re "*\\)?" + "[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)