comparison lisp/files.el @ 11180:7a9dceb0fb96

(inhibit-first-line-modes-suffixes): New variable. (set-auto-mode): Use it. (inhibit-first-line-modes-regexps): Use \\', not $.
author Richard M. Stallman <rms@gnu.org>
date Sun, 02 Apr 1995 02:22:14 +0000
parents 7d4a038bc511
children a2a85a29cdd6
comparison
equal deleted inserted replaced
11179:9ff0cfb97106 11180:7a9dceb0fb96
912 Each element looks like (INTERPRETER . MODE). 912 Each element looks like (INTERPRETER . MODE).
913 The car of each element is compared with 913 The car of each element is compared with
914 the name of the interpreter specified in the first line. 914 the name of the interpreter specified in the first line.
915 If it matches, mode MODE is selected.") 915 If it matches, mode MODE is selected.")
916 916
917 (defconst inhibit-first-line-modes-regexps '("\\.tar$") 917 (defconst inhibit-first-line-modes-regexps '("\\.tar\\'")
918 "List of regexps; if one matches a file name, don't look for `-*-'.") 918 "List of regexps; if one matches a file name, don't look for `-*-'.")
919
920 (defconst inhibit-first-line-modes-suffixes nil
921 "List of regexps for what to ignore, for `inhibit-first-line-modes-regexps'.
922 When checking `inhibit-first-line-modes-regexps', we first discard
923 from the end of the file name anything that matches one of these regexps.")
919 924
920 (defvar user-init-file 925 (defvar user-init-file
921 "" ; set by command-line 926 "" ; set by command-line
922 "File name including directory of user's initialization file.") 927 "File name including directory of user's initialization file.")
923 928
941 (and enable-local-variables 946 (and enable-local-variables
942 ;; Don't look for -*- if this file name matches any 947 ;; Don't look for -*- if this file name matches any
943 ;; of the regexps in inhibit-first-line-modes-regexps. 948 ;; of the regexps in inhibit-first-line-modes-regexps.
944 (let ((temp inhibit-first-line-modes-regexps) 949 (let ((temp inhibit-first-line-modes-regexps)
945 (name (file-name-sans-versions buffer-file-name))) 950 (name (file-name-sans-versions buffer-file-name)))
951 (if (string-match inhibit-first-line-modes-suffixes name)
952 (setq name (substring name 0 (match-beginning 0))))
946 (while (and temp 953 (while (and temp
947 (not (string-match (car temp) 954 (not (string-match (car temp) name)))
948 name)))
949 (setq temp (cdr temp))) 955 (setq temp (cdr temp)))
950 (not temp)) 956 (not temp))
951 (search-forward "-*-" (save-excursion 957 (search-forward "-*-" (save-excursion
952 ;; If the file begins with "#!" 958 ;; If the file begins with "#!"
953 ;; (exec interpreter magic), look 959 ;; (exec interpreter magic), look