changeset 2552:ce9a2a209b97

(set-auto-mode): If the buffer begins with "#!", look for -*- in the first two lines, not just the first one.
author Roland McGrath <roland@gnu.org>
date Mon, 19 Apr 1993 20:27:50 +0000
parents 551af54fb173
children 61e4e09e7243
files lisp/files.el
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Sat Apr 17 21:46:13 1993 +0000
+++ b/lisp/files.el	Mon Apr 19 20:27:50 1993 +0000
@@ -1,6 +1,6 @@
 ;;; files.el --- file input and output commands for Emacs
 
-;; Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1986, 1987, 1992, 1993 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 
@@ -694,7 +694,16 @@
       (goto-char (point-min))
       (skip-chars-forward " \t\n")
       (if (and enable-local-variables
-	       (search-forward "-*-" (save-excursion (end-of-line) (point)) t)
+	       (search-forward "-*-" (save-excursion
+				       ;; If the file begins with "#!"
+				       ;; (exec interpreter magic), look
+				       ;; for mode frobs in the first two
+				       ;; lines.  You cannot necessarily
+				       ;; put them in the first line of
+				       ;; such a file without screwing up
+				       ;; the interpreter invocation.
+				       (end-of-line (and (looking-at "^#!") 2))
+				       (point)) t)
 	       (progn
 		 (skip-chars-forward " \t")
 		 (setq beg (point))