If the element has the form (REGEXP FUNCTION NON-NIL), then after
calling FUNCTION (if it's not nil), we delete the suffix that matched
-REGEXP and search the list again for another match.")
+REGEXP and search the list again for another match.
+If the file name matches `inhibit-first-line-modes-regexps',
+then `auto-mode-alist' is not processed.
+
+See also `interpreter-mode-alist', which detects executable script modes
+based on the interpreters they specify to run,
+and `magic-mode-alist', which determines modes based on file contents.")
(defvar interpreter-mode-alist
;; Note: The entries for the modes defined in cc-mode.el (awk-mode
("guile" . scheme-mode)
("clisp" . lisp-mode)))
"Alist mapping interpreter names to major modes.
-This alist applies to files whose first line starts with `#!'.
+This is used for files whose first lines match `auto-mode-interpreter-regexp'.
Each element looks like (INTERPRETER . MODE).
The car of each element is compared with
the name of the interpreter specified in the first line.
-If it matches, mode MODE is selected.")
+If it matches, mode MODE is selected.
+
+See also `auto-mode-alist'.")
(defvar inhibit-first-line-modes-regexps '("\\.tar\\'" "\\.tgz\\'")
"List of regexps; if one matches a file name, don't look for `-*-'.")
(concat "\\(?:<\\?xml\\s +[^>]*>\\)?\\s *<"
comment-re "*"
"\\(?:!DOCTYPE\\s +[^>]*>\\s *<\\s *" comment-re "*\\)?"
- "[Hh][Tt][Mm][Ll]")) . html-mode)
+ "[Hh][Tt][Mm][Ll]"))
+ . html-mode)
;; These two must come after html, because they are more general:
("<\\?xml " . xml-mode)
(,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)")
(comment-re (concat "\\(?:!--" incomment-re "*-->\\s *<\\)")))
- (concat "\\s *<" comment-re "*!DOCTYPE ")) . sgml-mode)
+ (concat "\\s *<" comment-re "*!DOCTYPE "))
+ . sgml-mode)
("%![^V]" . ps-mode)
("# xmcd " . conf-unix-mode))
"Alist of buffer beginnings vs. corresponding major mode functions.
;; but inhibited if one of write-file-functions returns non-nil.
;; It returns a value (MODES . BACKUPNAME), like backup-buffer.
(defun basic-save-buffer-1 ()
- (if save-buffer-coding-system
- (let ((coding-system-for-write save-buffer-coding-system))
+ (prog1
+ (if save-buffer-coding-system
+ (let ((coding-system-for-write save-buffer-coding-system))
+ (basic-save-buffer-2))
(basic-save-buffer-2))
- (basic-save-buffer-2))
- (setq buffer-file-coding-system-explicit last-coding-system-used))
+ (setq buffer-file-coding-system-explicit last-coding-system-used)))
;; This returns a value (MODES . BACKUPNAME), like backup-buffer.
(defun basic-save-buffer-2 ()