Show
Ignore:
Timestamp:
06/02/07 09:29:41 (1 year ago)
Author:
miyoshi
Message:

Sync up with Emacs_22_BASE.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/files.el

    r4207 r4210  
    288288A value of `visit-save' means do it at both of those times. 
    289289Any other non-nil value means ask user whether to add a newline, when saving. 
    290 nil means don't add newlines. 
     290A value of nil means don't add newlines. 
    291291 
    292292Certain major modes set this locally to the value obtained 
     
    310310Any other non-nil value means ask user whether to add a newline, when saving. 
    311311 
    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 ad
    315 a final newline, whenever you save a file that really needs one." 
     312A value of nil means do not add newlines.  That is a risky choice in this 
     313variable since this value is used for modes for files that ought to have 
     314final newlines.  So if you set this to nil, you must explicitly check an
     315add a final newline, whenever you save a file that really needs one." 
    316316  :type '(choice (const :tag "When visiting" visit) 
    317317                 (const :tag "When saving" t) 
     
    460460:all means set all variables, whether safe or not. 
    461461 (Don't set it permanently to :all.) 
    462 nil means always ignore the file local variables. 
     462A value of nil means always ignore the file local variables. 
    463463 
    464464Any other value means always query you once whether to set them all. 
     
    492492The value can be t, nil or something else. 
    493493A value of t means obey `eval' variables; 
    494 nil means ignore them; anything else means query." 
     494A value of nil means ignore them; anything else means query." 
    495495  :type '(choice (const :tag "Obey" t) 
    496496                 (const :tag "Ignore" nil) 
     
    21212121 
    21222122(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. 
     2125Each element looks like (REGEXP . FUNCTION) or (MATCH-FUNCTION . FUNCTION). 
     2126After visiting a file, if REGEXP matches the text at the beginning of the 
     2127buffer, or calling MATCH-FUNCTION returns non-nil, `normal-mode' will 
     2128call FUNCTION rather than allowing `auto-mode-alist' to decide the buffer's 
     2129major mode. 
     2130 
     2131If 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. 
    21252137    ;; TODO: UTF-16 <?xml may be preceded by a BOM 0xff 0xfe or 0xfe 0xff. 
    21262138    ;; We use [ \t\r\n] instead of `\\s ' to make regex overflow less likely. 
     
    21412153    ("%!PS" . ps-mode) 
    21422154    ("# 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 the 
    2146 buffer, or calling MATCH-FUNCTION returns non-nil, `normal-mode' will 
    2147 call FUNCTION rather than allowing `auto-mode-alist' to decide the buffer's 
    2148 major mode. 
    2149  
    2150 If FUNCTION is nil, then it is not called.  (That is a way of saying 
    2151 \"allow `auto-mode-alist' to decide for these files.\")") 
    2152 (put 'magic-mode-alist 'risky-local-variable t) 
    2153  
    2154 (defvar file-start-mode-alist 
    2155   nil 
    21562155  "Like `magic-mode-alist' but has lower priority than `auto-mode-alist'. 
    21572156Each element looks like (REGEXP . FUNCTION) or (MATCH-FUNCTION . FUNCTION). 
     
    21622161 
    21632162If 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) 
    21652164 
    21662165(defvar magic-mode-regexp-match-limit 4000 
    21672166  "Upper limit on `magic-mode-alist' regexp matches. 
    2168 Also applies to `file-start-mode-alist'.") 
     2167Also applies to `magic-fallback-mode-alist'.") 
    21692168 
    21702169(defun set-auto-mode (&optional keep-mode-if-same) 
    21712170  "Select major mode appropriate for current buffer. 
    21722171 
    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'. 
     2172To find the right major mode, this function checks for a -*- mode tag, 
     2173checks if it uses an interpreter listed in `interpreter-mode-alist', 
     2174matches the buffer beginning against `magic-mode-alist', 
     2175compares the filename against the entries in `auto-mode-alist', 
     2176then matches the buffer beginning against `magic-fallback-mode-alist'. 
    21772177 
    21782178It does not check for the `mode:' local variable in the 
     
    21832183 
    21842184If the optional argument KEEP-MODE-IF-SAME is non-nil, then we 
    2185 only set the major mode, if that would change it." 
     2185set the major mode only if that would change it.  In other words 
     2186we don't actually set it to the same mode the buffer already has." 
    21862187  ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*- 
    21872188  (let (end done mode modes) 
     
    22852286                (set-auto-mode-0 mode keep-mode-if-same) 
    22862287                (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. 
    22882289    (unless done 
    22892290      (if (setq done (save-excursion 
     
    22932294                                           (min (point-max) 
    22942295                                                (+ (point-min) magic-mode-regexp-match-limit))) 
    2295                          (assoc-default nil file-start-mode-alist 
     2296                         (assoc-default nil magic-fallback-mode-alist 
    22962297                                        (lambda (re dummy) 
    22972298                                          (if (functionp re)