From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Adalbert Perbandt Newsgroups: gmane.emacs.help Subject: Major Mode Determination from File Contents Date: 23 Apr 2003 15:55:40 +0200 Organization: Infineon Technologies Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1051106758 8980 80.91.224.249 (23 Apr 2003 14:05:58 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Apr 2003 14:05:58 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 23 16:05:56 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 198Ksm-0002KZ-00 for ; Wed, 23 Apr 2003 16:05:56 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 198KsN-0007ct-02 for gnu-help-gnu-emacs@m.gmane.org; Wed, 23 Apr 2003 10:05:31 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!newsfeed.esat.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsproxy.muc.infineon.com!news.infineon.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 38 Original-X-Trace: newssrv.muc.infineon.com 1051106141 8905 172.31.17.25 (23 Apr 2003 13:55:41 GMT) Original-X-Complaints-To: usenet@infineon.com Original-NNTP-Posting-Date: Wed, 23 Apr 2003 13:55:41 +0000 (UTC) User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Portable Code) Original-Xref: shelby.stanford.edu gnu.emacs.help:112215 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:8714 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:8714 Hi there, I have a serious problem with automatically setting a specific mode for files depending on their contents. Due to some good reason we had to insert this header into our Perl script files: #!/bin/sh exec $IW_PERL -x -w -S $0 ${1+"$@"} Now I no longer could place -*- cperl -*- into the first line because this would confuse the execve system call which executes some of these files. Until now I know these ways to specify the mode for a file automagically: 1. By extension -- Doesn't fit here because the perl scripts do not have any extension. 2. By placing the above given line in the first nonempty line of the file -- No longer possible. 3. Local Variable list at the end of the file -- Would work but looks somewhat ugly. 4. Setup of interpreter-mode-alist Variable -- Doesn't work because only the first line is processed by this mechanism. Is their any other way to put the "-*- cperl -*-" line near the top of the file and get it processed by some mode determination mechanism? Any ideas would be welcome. Thanks, Adalbert Perbandt.