# HG changeset patch # User Richard M. Stallman # Date 796789334 0 # Node ID 7a9dceb0fb96fda742be0fc9d590f57a903881a8 # Parent 9ff0cfb97106b3bc5a4a0573e4bf28670635f670 (inhibit-first-line-modes-suffixes): New variable. (set-auto-mode): Use it. (inhibit-first-line-modes-regexps): Use \\', not $. diff -r 9ff0cfb97106 -r 7a9dceb0fb96 lisp/files.el --- 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