diff options
| author | Richard M. Stallman | 1993-05-31 21:50:52 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-05-31 21:50:52 +0000 |
| commit | a0c9f21b2d32bb5f44e4954eb5b3465fc73510a4 (patch) | |
| tree | 614f687913758cdfb53506ee828b7aa882a2be2e | |
| parent | f8bc869a313bf255d35e0c1d255eb5aaa8296f24 (diff) | |
| download | emacs-a0c9f21b2d32bb5f44e4954eb5b3465fc73510a4.tar.gz emacs-a0c9f21b2d32bb5f44e4954eb5b3465fc73510a4.zip | |
(inhibit-local-variables-regexps): New variable.
(set-auto-mode): Handle inhibit-local-variables-regexps.
| -rw-r--r-- | lisp/files.el | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/files.el b/lisp/files.el index 83322d05aa2..33d889dd5f8 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -790,6 +790,9 @@ Alist of filename patterns vs corresponding major mode functions. | |||
| 790 | Each element looks like (REGEXP . FUNCTION). | 790 | Each element looks like (REGEXP . FUNCTION). |
| 791 | Visiting a file whose name matches REGEXP causes FUNCTION to be called.") | 791 | Visiting a file whose name matches REGEXP causes FUNCTION to be called.") |
| 792 | 792 | ||
| 793 | (defconst inhibit-local-variables-regexps '("\\.tar$") | ||
| 794 | "List of regexps; if one matches a file name, don't look for local vars.") | ||
| 795 | |||
| 793 | (defun set-auto-mode () | 796 | (defun set-auto-mode () |
| 794 | "Select major mode appropriate for current buffer. | 797 | "Select major mode appropriate for current buffer. |
| 795 | This checks for a -*- mode tag in the buffer's text, or | 798 | This checks for a -*- mode tag in the buffer's text, or |
| @@ -805,6 +808,14 @@ If `enable-local-variables' is nil, this function does not check for a | |||
| 805 | (goto-char (point-min)) | 808 | (goto-char (point-min)) |
| 806 | (skip-chars-forward " \t\n") | 809 | (skip-chars-forward " \t\n") |
| 807 | (if (and enable-local-variables | 810 | (if (and enable-local-variables |
| 811 | ;; Don't look for -*- if this file name matches any | ||
| 812 | ;; of the regexps in inhibit-local-variables-regexps. | ||
| 813 | (not (let ((temp inhibit-local-variables-regexps)) | ||
| 814 | (while (and temp | ||
| 815 | (not (string-match (car temp) | ||
| 816 | buffer-file-name))) | ||
| 817 | (setq temp (cdr temp))) | ||
| 818 | (not temp))) | ||
| 808 | (search-forward "-*-" (save-excursion | 819 | (search-forward "-*-" (save-excursion |
| 809 | ;; If the file begins with "#!" | 820 | ;; If the file begins with "#!" |
| 810 | ;; (exec interpreter magic), look | 821 | ;; (exec interpreter magic), look |