From xemacs-m  Tue Dec  3 11:57:15 1996
Received: from CNRI.Reston.VA.US (CNRI.Reston.VA.US [132.151.1.1]) by xemacs.cs.uiuc.edu (8.8.3/8.8.3) with SMTP id LAA07645 for <xemacs-beta@xemacs.org>; Tue, 3 Dec 1996 11:57:14 -0600 (CST)
Received: from newcnri.cnri.reston.va.us by CNRI.Reston.VA.US id aa15787;
          3 Dec 96 12:58 EST
Received: from anthem.CNRI.Reston.Va.US by newcnri.CNRI.Reston.Va.US (SMI-8.6/SMI-SVR4)
	id MAA12735; Tue, 3 Dec 1996 12:58:21 -0500
Received: by anthem.CNRI.Reston.Va.US (SMI-8.6/SMI-SVR4)
	id MAA13877; Tue, 3 Dec 1996 12:58:20 -0500
Date: Tue, 3 Dec 1996 12:58:20 -0500
Message-Id: <199612031758.MAA13877@anthem.CNRI.Reston.Va.US>
From: "Barry A. Warsaw" <bwarsaw@anthem.cnri.reston.va.us>
To: xemacs-beta@xemacs.org
Subject: 19.15b2 patch to files.el:(set-auto-mode)
Reply-To: "Barry A. Warsaw" <bwarsaw@CNRI.Reston.VA.US>
X-Attribution: BAW
X-Oblique-Strategy: What mistakes did you make last time?
X-WWW-Homepage: http://www.python.org/~bwarsaw


The keys in interpreter-mode-alist are now regular expressions to
match against the first line of the file.  This is a good thing since
all kinds of different paths or invocations can be used
(e.g. /depot/gnu/plat/bin/python, /usr/local/python, /usr/bin/env python)

However, set-auto-mode should require that the line begins with `#!'
otherwise non-program files with the interpreter word in the first
line will get incorrectly set.

Here's a patch to 19.15b2's version of set-auto-mode that first checks
for `#!' at the beginning of the file.

-Barry

-------------------- snip snip --------------------
*** patches-19.14.el	1996/11/20 18:38:33	1.2
--- patches-19.14.el	1996/12/03 17:51:30
***************
*** 51,55 ****
                ;; If we can't deduce a mode from the file name,
                ;; look for an interpreter specified in the first line.
! 	      (if (null mode)
                    (let ((firstline
                           (buffer-substring
--- 51,58 ----
                ;; If we can't deduce a mode from the file name,
                ;; look for an interpreter specified in the first line.
! 	      (if (and (null mode)
! 		       (save-excursion
! 			 (goto-char (point-min))
! 			 (looking-at "#!")))
                    (let ((firstline
                           (buffer-substring

