Mercurial > emacs
comparison lisp/files.el @ 81059:255e52f43455
Merge from emacs--rel--22
Patches applied:
* emacs--rel--22 (patch 24)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-767
author | Miles Bader <miles@gnu.org> |
---|---|
date | Thu, 24 May 2007 06:25:50 +0000 |
parents | 4e63146a7097 cf838464b396 |
children | 094200bbe6b7 422451dd396a 31beec9ee600 |
comparison
equal
deleted
inserted
replaced
81058:b6ab0a86a34c | 81059:255e52f43455 |
---|---|
2169 Also applies to `magic-fallback-mode-alist'.") | 2169 Also applies to `magic-fallback-mode-alist'.") |
2170 | 2170 |
2171 (defun set-auto-mode (&optional keep-mode-if-same) | 2171 (defun set-auto-mode (&optional keep-mode-if-same) |
2172 "Select major mode appropriate for current buffer. | 2172 "Select major mode appropriate for current buffer. |
2173 | 2173 |
2174 This checks for a -*- mode tag in the buffer's text, checks the | 2174 To find the right major mode, this function checks for a -*- mode tag, |
2175 interpreter that runs this file against `interpreter-mode-alist', | 2175 checks if it uses an interpreter listed in `interpreter-mode-alist', |
2176 compares the buffer beginning against `magic-mode-alist', or | 2176 matches the buffer beginning against `magic-mode-alist', |
2177 compares the filename against the entries in `auto-mode-alist'. | 2177 compares the filename against the entries in `auto-mode-alist', |
2178 then matches the buffer beginning against `magic-fallback-mode-alist'. | |
2178 | 2179 |
2179 It does not check for the `mode:' local variable in the | 2180 It does not check for the `mode:' local variable in the |
2180 Local Variables section of the file; for that, use `hack-local-variables'. | 2181 Local Variables section of the file; for that, use `hack-local-variables'. |
2181 | 2182 |
2182 If `enable-local-variables' is nil, this function does not check for a | 2183 If `enable-local-variables' is nil, this function does not check for a |
2183 -*- mode tag. | 2184 -*- mode tag. |
2184 | 2185 |
2185 If the optional argument KEEP-MODE-IF-SAME is non-nil, then we | 2186 If the optional argument KEEP-MODE-IF-SAME is non-nil, then we |
2186 only set the major mode, if that would change it." | 2187 set the major mode only if that would change it. In other words |
2188 we don't actually set it to the same mode the buffer already has." | |
2187 ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*- | 2189 ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*- |
2188 (let (end done mode modes) | 2190 (let (end done mode modes) |
2189 ;; Find a -*- mode tag | 2191 ;; Find a -*- mode tag |
2190 (save-excursion | 2192 (save-excursion |
2191 (goto-char (point-min)) | 2193 (goto-char (point-min)) |