]> git.eshelyaron.com Git - emacs.git/commitdiff
(inhibit-first-line-modes-suffixes): New variable.
authorRichard M. Stallman <rms@gnu.org>
Sun, 2 Apr 1995 02:22:14 +0000 (02:22 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sun, 2 Apr 1995 02:22:14 +0000 (02:22 +0000)
(set-auto-mode): Use it.
(inhibit-first-line-modes-regexps): Use \\', not $.

lisp/files.el

index 0003bd533fe4c3e6456157bde135be083b268a54..1a0bc74ea9405c500f4fce7ab8c6ba20e5be3117 100644 (file)
@@ -914,9 +914,14 @@ 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.")
 
-(defconst inhibit-first-line-modes-regexps '("\\.tar$")
+(defconst inhibit-first-line-modes-regexps '("\\.tar\\'")
   "List of regexps; if one matches a file name, don't look for `-*-'.")
 
+(defconst inhibit-first-line-modes-suffixes nil
+  "List of regexps for what to ignore, for `inhibit-first-line-modes-regexps'.
+When checking `inhibit-first-line-modes-regexps', we first discard
+from the end of the file name anything that matches one of these regexps.")
+
 (defvar user-init-file
   "" ; set by command-line
   "File name including directory of user's initialization file.")
@@ -943,9 +948,10 @@ If `enable-local-variables' is nil, this function does not check for a
           ;; of the regexps in inhibit-first-line-modes-regexps.
           (let ((temp inhibit-first-line-modes-regexps)
                 (name (file-name-sans-versions buffer-file-name)))
+            (if (string-match inhibit-first-line-modes-suffixes name)
+                (setq name (substring name 0 (match-beginning 0))))
             (while (and temp
-                        (not (string-match (car temp)
-                                           name)))
+                        (not (string-match (car temp) name)))
               (setq temp (cdr temp)))
             (not temp))
           (search-forward "-*-" (save-excursion