Variable: magic-fallback-mode-alist

magic-fallback-mode-alist is a variable defined in files.el.gz.

Value

((image-type-auto-detected-p . image-mode)
 ("\\(PK00\\)?[P]K" . archive-mode)
 ("\\(?:<\\?xml[     
\n]+[^>]*>\\)?[         
\n]*<\\(?:!--\\(?:[^-]\\|-[^-]\\)*-->[  
\n]*<\\)*\\(?:!DOCTYPE[    
\n]+[^>]*>[     
\n]*<[     
\n]*\\(?:!--\\(?:[^-]\\|-[^-]\\)*-->[      
\n]*<\\)*\\)?[Hh][Tt][Mm][Ll]"
  . mhtml-mode)
 ("<![Dd][Oo][Cc][Tt][Yy][Pp][Ee][   
\n]+[Hh][Tt][Mm][Ll]"
  . mhtml-mode)
 ("<\\?xml " . xml-mode)
 ("[    
\n]*<\\(?:!--\\(?:[^-]\\|-[^-]\\)*-->[  
\n]*<\\)*!DOCTYPE "
  . sgml-mode)
 ("\320\317\340\241\261\341" . doc-view-mode-maybe)
 ("%!PS" . ps-mode) ("# xmcd " . conf-unix-mode))

Documentation

Like magic-mode-alist but has lower priority than auto-mode-alist.

Each element looks like (REGEXP . FUNCTION) or (MATCH-FUNCTION . FUNCTION). After visiting a file, if REGEXP matches the text at the beginning of the buffer (case-sensitively), or calling MATCH-FUNCTION returns non-nil, normal-mode will call FUNCTION, provided that magic-mode-alist and auto-mode-alist have not specified a mode for this file.

If FUNCTION is nil, then it is not called.

View in manual

Probably introduced at or before Emacs version 22.1.

Source Code

;; Defined in /usr/src/emacs/lisp/files.el.gz
(defvar magic-fallback-mode-alist
  `((image-type-auto-detected-p . image-mode)
    ("\\(PK00\\)?[P]K\003\004" . archive-mode) ; zip
    ;; The < comes before the groups (but the first) to reduce backtracking.
    ;; TODO: UTF-16 <?xml may be preceded by a BOM 0xff 0xfe or 0xfe 0xff.
    ;; We use [ \t\r\n] instead of `\\s ' to make regex overflow less likely.
    (,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)")
	     (comment-re (concat "\\(?:!--" incomment-re "*-->[ \t\r\n]*<\\)")))
	(concat "\\(?:<\\?xml[ \t\r\n]+[^>]*>\\)?[ \t\r\n]*<"
		comment-re "*"
		"\\(?:!DOCTYPE[ \t\r\n]+[^>]*>[ \t\r\n]*<[ \t\r\n]*" comment-re "*\\)?"
		"[Hh][Tt][Mm][Ll]"))
     . mhtml-mode)
    ("<![Dd][Oo][Cc][Tt][Yy][Pp][Ee][ \t\r\n]+[Hh][Tt][Mm][Ll]" . mhtml-mode)
    ;; These two must come after html, because they are more general:
    ("<\\?xml " . xml-mode)
    (,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)")
	     (comment-re (concat "\\(?:!--" incomment-re "*-->[ \t\r\n]*<\\)")))
	(concat "[ \t\r\n]*<" comment-re "*!DOCTYPE "))
     . sgml-mode)
    ("\320\317\021\340\241\261\032\341" . doc-view-mode-maybe) ; Word documents 1997-2004
    ("%!PS" . ps-mode)
    ("# xmcd " . conf-unix-mode))
  "Like `magic-mode-alist' but has lower priority than `auto-mode-alist'.
Each element looks like (REGEXP . FUNCTION) or (MATCH-FUNCTION . FUNCTION).
After visiting a file, if REGEXP matches the text at the beginning of the
buffer (case-sensitively), or calling MATCH-FUNCTION returns non-nil,
`normal-mode' will call FUNCTION, provided that `magic-mode-alist' and
`auto-mode-alist' have not specified a mode for this file.

If FUNCTION is nil, then it is not called.")