help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Major Mode Determination from File Contents


From: Adalbert Perbandt
Subject: Major Mode Determination from File Contents
Date: 23 Apr 2003 15:55:40 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Portable Code)

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]