changeset 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 9ff0cfb97106
children 67a8c8274784
files lisp/files.el
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Sun Apr 02 02:21:56 1995 +0000
+++ b/lisp/files.el	Sun Apr 02 02:22:14 1995 +0000
@@ -914,9 +914,14 @@
 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 @@
 	   ;; 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