Changeset 4210 for trunk/lisp/files.el
- Timestamp:
- 06/02/07 09:29:41 (1 year ago)
- Files:
-
- trunk/lisp/files.el (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lisp/files.el
r4207 r4210 288 288 A value of `visit-save' means do it at both of those times. 289 289 Any other non-nil value means ask user whether to add a newline, when saving. 290 nil means don't add newlines.290 A value of nil means don't add newlines. 291 291 292 292 Certain major modes set this locally to the value obtained … … 310 310 Any other non-nil value means ask user whether to add a newline, when saving. 311 311 312 nil means do not add newlines. That is a risky choice in this variable 313 since this value is used for modes for files that ought to have final newlines. 314 So if you set this to nil, you must explicitly check and add315 a final newline, whenever you save a file that really needs one."312 A value of nil means do not add newlines. That is a risky choice in this 313 variable since this value is used for modes for files that ought to have 314 final newlines. So if you set this to nil, you must explicitly check and 315 add a final newline, whenever you save a file that really needs one." 316 316 :type '(choice (const :tag "When visiting" visit) 317 317 (const :tag "When saving" t) … … 460 460 :all means set all variables, whether safe or not. 461 461 (Don't set it permanently to :all.) 462 nil means always ignore the file local variables.462 A value of nil means always ignore the file local variables. 463 463 464 464 Any other value means always query you once whether to set them all. … … 492 492 The value can be t, nil or something else. 493 493 A value of t means obey `eval' variables; 494 nil means ignore them; anything else means query."494 A value of nil means ignore them; anything else means query." 495 495 :type '(choice (const :tag "Obey" t) 496 496 (const :tag "Ignore" nil) … … 2121 2121 2122 2122 (defvar magic-mode-alist 2123 `((image-type-auto-detected-p . image-mode) 2124 ;; The < comes before the groups (but the first) to reduce backtracking. 2123 `((image-type-auto-detected-p . image-mode)) 2124 "Alist of buffer beginnings vs. corresponding major mode functions. 2125 Each element looks like (REGEXP . FUNCTION) or (MATCH-FUNCTION . FUNCTION). 2126 After visiting a file, if REGEXP matches the text at the beginning of the 2127 buffer, or calling MATCH-FUNCTION returns non-nil, `normal-mode' will 2128 call FUNCTION rather than allowing `auto-mode-alist' to decide the buffer's 2129 major mode. 2130 2131 If FUNCTION is nil, then it is not called. (That is a way of saying 2132 \"allow `auto-mode-alist' to decide for these files.\")") 2133 (put 'magic-mode-alist 'risky-local-variable t) 2134 2135 (defvar magic-fallback-mode-alist 2136 `(;; The < comes before the groups (but the first) to reduce backtracking. 2125 2137 ;; TODO: UTF-16 <?xml may be preceded by a BOM 0xff 0xfe or 0xfe 0xff. 2126 2138 ;; We use [ \t\r\n] instead of `\\s ' to make regex overflow less likely. … … 2141 2153 ("%!PS" . ps-mode) 2142 2154 ("# xmcd " . conf-unix-mode)) 2143 "Alist of buffer beginnings vs. corresponding major mode functions.2144 Each element looks like (REGEXP . FUNCTION) or (MATCH-FUNCTION . FUNCTION).2145 After visiting a file, if REGEXP matches the text at the beginning of the2146 buffer, or calling MATCH-FUNCTION returns non-nil, `normal-mode' will2147 call FUNCTION rather than allowing `auto-mode-alist' to decide the buffer's2148 major mode.2149 2150 If FUNCTION is nil, then it is not called. (That is a way of saying2151 \"allow `auto-mode-alist' to decide for these files.\")")2152 (put 'magic-mode-alist 'risky-local-variable t)2153 2154 (defvar file-start-mode-alist2155 nil2156 2155 "Like `magic-mode-alist' but has lower priority than `auto-mode-alist'. 2157 2156 Each element looks like (REGEXP . FUNCTION) or (MATCH-FUNCTION . FUNCTION). … … 2162 2161 2163 2162 If FUNCTION is nil, then it is not called.") 2164 (put ' file-start-mode-alist 'risky-local-variable t)2163 (put 'magic-fallback-mode-alist 'risky-local-variable t) 2165 2164 2166 2165 (defvar magic-mode-regexp-match-limit 4000 2167 2166 "Upper limit on `magic-mode-alist' regexp matches. 2168 Also applies to ` file-start-mode-alist'.")2167 Also applies to `magic-fallback-mode-alist'.") 2169 2168 2170 2169 (defun set-auto-mode (&optional keep-mode-if-same) 2171 2170 "Select major mode appropriate for current buffer. 2172 2171 2173 This checks for a -*- mode tag in the buffer's text, checks the 2174 interpreter that runs this file against `interpreter-mode-alist', 2175 compares the buffer beginning against `magic-mode-alist', or 2176 compares the filename against the entries in `auto-mode-alist'. 2172 To find the right major mode, this function checks for a -*- mode tag, 2173 checks if it uses an interpreter listed in `interpreter-mode-alist', 2174 matches the buffer beginning against `magic-mode-alist', 2175 compares the filename against the entries in `auto-mode-alist', 2176 then matches the buffer beginning against `magic-fallback-mode-alist'. 2177 2177 2178 2178 It does not check for the `mode:' local variable in the … … 2183 2183 2184 2184 If the optional argument KEEP-MODE-IF-SAME is non-nil, then we 2185 only set the major mode, if that would change it." 2185 set the major mode only if that would change it. In other words 2186 we don't actually set it to the same mode the buffer already has." 2186 2187 ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*- 2187 2188 (let (end done mode modes) … … 2285 2286 (set-auto-mode-0 mode keep-mode-if-same) 2286 2287 (setq done t)))))) 2287 ;; Next try matching the buffer beginning against file-start-mode-alist.2288 ;; Next try matching the buffer beginning against magic-fallback-mode-alist. 2288 2289 (unless done 2289 2290 (if (setq done (save-excursion … … 2293 2294 (min (point-max) 2294 2295 (+ (point-min) magic-mode-regexp-match-limit))) 2295 (assoc-default nil file-start-mode-alist2296 (assoc-default nil magic-fallback-mode-alist 2296 2297 (lambda (re dummy) 2297 2298 (if (functionp re)
