* Major Mode Determination from File Contents
@ 2003-04-23 13:55 Adalbert Perbandt
2003-04-23 14:48 ` Glenn Morris
0 siblings, 1 reply; 4+ messages in thread
From: Adalbert Perbandt @ 2003-04-23 13:55 UTC (permalink / raw)
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Major Mode Determination from File Contents
2003-04-23 13:55 Major Mode Determination from File Contents Adalbert Perbandt
@ 2003-04-23 14:48 ` Glenn Morris
2003-04-25 8:04 ` Adalbert Perbandt
0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2003-04-23 14:48 UTC (permalink / raw)
Adalbert Perbandt wrote:
[can't set file local variables in shell scripts]
Emacs info node "Local Variables in Files":
In shell scripts, the first line is used to identify the script
interpreter, so you cannot put any local variables there. To
accommodate for this, when Emacs visits a shell script, it looks
for local variable specifications in the _second_ line.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Major Mode Determination from File Contents
2003-04-23 14:48 ` Glenn Morris
@ 2003-04-25 8:04 ` Adalbert Perbandt
2003-04-25 9:34 ` Glenn Morris
0 siblings, 1 reply; 4+ messages in thread
From: Adalbert Perbandt @ 2003-04-25 8:04 UTC (permalink / raw)
Glenn Morris <gmorris+news@ast.cam.ac.uk> writes:
> Adalbert Perbandt wrote:
[...]
> Emacs info node "Local Variables in Files":
[...]
Thanks a lot! Works fine. Unfortunately the text you quoted was not
contained in the info doc for XEmacs 21.4.12 which I use.
Regards,
Adalbert Perbandt.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Major Mode Determination from File Contents
2003-04-25 8:04 ` Adalbert Perbandt
@ 2003-04-25 9:34 ` Glenn Morris
0 siblings, 0 replies; 4+ messages in thread
From: Glenn Morris @ 2003-04-25 9:34 UTC (permalink / raw)
Adalbert Perbandt wrote:
> Unfortunately the text you quoted was not contained in the info doc
> for XEmacs 21.4.12 which I use.
Wrong newsgroup then. comp.emacs.xemacs is that way ->...
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-04-25 9:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-23 13:55 Major Mode Determination from File Contents Adalbert Perbandt
2003-04-23 14:48 ` Glenn Morris
2003-04-25 8:04 ` Adalbert Perbandt
2003-04-25 9:34 ` Glenn Morris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).