comparison lisp/files.el @ 68827:9e3243a12c5f

(magic-mode-alist): Don't use `\\s ' in regexps.
author Richard M. Stallman <rms@gnu.org>
date Sun, 12 Feb 2006 20:30:28 +0000
parents 739ab5567adc
children 5340157fbfc2
comparison
equal deleted inserted replaced
68826:17c561f80e48 68827:9e3243a12c5f
2022 associated with that interpreter in `interpreter-mode-alist'.") 2022 associated with that interpreter in `interpreter-mode-alist'.")
2023 2023
2024 (defvar magic-mode-alist 2024 (defvar magic-mode-alist
2025 `(;; The < comes before the groups (but the first) to reduce backtracking. 2025 `(;; The < comes before the groups (but the first) to reduce backtracking.
2026 ;; TODO: UTF-16 <?xml may be preceded by a BOM 0xff 0xfe or 0xfe 0xff. 2026 ;; TODO: UTF-16 <?xml may be preceded by a BOM 0xff 0xfe or 0xfe 0xff.
2027 ;; We use [ \t\n] instead of `\\s ' to make regex overflow less likely.
2027 (,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)") 2028 (,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)")
2028 (comment-re (concat "\\(?:!--" incomment-re "*-->\\s *<\\)"))) 2029 (comment-re (concat "\\(?:!--" incomment-re "*-->[ \t\n]*<\\)")))
2029 (concat "\\(?:<\\?xml\\s +[^>]*>\\)?\\s *<" 2030 (concat "\\(?:<\\?xml[ \t\n]+[^>]*>\\)?[ \t\n]*<"
2030 comment-re "*" 2031 comment-re "*"
2031 "\\(?:!DOCTYPE\\s +[^>]*>\\s *<\\s *" comment-re "*\\)?" 2032 "\\(?:!DOCTYPE[ \t\n]+[^>]*>[ \t\n]*<[ \t\n]*" comment-re "*\\)?"
2032 "[Hh][Tt][Mm][Ll]")) 2033 "[Hh][Tt][Mm][Ll]"))
2033 . html-mode) 2034 . html-mode)
2034 ;; These two must come after html, because they are more general: 2035 ;; These two must come after html, because they are more general:
2035 ("<\\?xml " . xml-mode) 2036 ("<\\?xml " . xml-mode)
2036 (,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)") 2037 (,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)")
2037 (comment-re (concat "\\(?:!--" incomment-re "*-->\\s *<\\)"))) 2038 (comment-re (concat "\\(?:!--" incomment-re "*-->[ \t\n]*<\\)")))
2038 (concat "\\s *<" comment-re "*!DOCTYPE ")) 2039 (concat "[ \t\n]*<" comment-re "*!DOCTYPE "))
2039 . sgml-mode) 2040 . sgml-mode)
2040 ("%![^V]" . ps-mode) 2041 ("%![^V]" . ps-mode)
2041 ("# xmcd " . conf-unix-mode)) 2042 ("# xmcd " . conf-unix-mode))
2042 "Alist of buffer beginnings vs. corresponding major mode functions. 2043 "Alist of buffer beginnings vs. corresponding major mode functions.
2043 Each element looks like (REGEXP . FUNCTION). After visiting a file, 2044 Each element looks like (REGEXP . FUNCTION). After visiting a file,