[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
interpeter-mode-alist should handle regexps like auto-mode-alist
From: |
Andrew M. Scott~ |
Subject: |
interpeter-mode-alist should handle regexps like auto-mode-alist |
Date: |
Tue, 21 Sep 2004 12:53:18 -0700 |
I'm using a Sept 13, 2004 GNU/Linux build of CVS Emacs-21.3.50.
interpeter-mode-alist should handle regexps (like auto-mode-alist
does), which would facilitate editing perl scripts hardcoded with
multiple versions of perl in either perl-mode or cperl-mode.
e.g. I would like to invoke cperl-mode for perl scripts using multiple
versions of perl, e.g. with first first lines of:
#!/usr/bin/perl5
#!/usr/bin/perl5.61
#!/usr/bin/perl5.8.5
Using an individual line per perl version in my ~/.emacs works fine:
(add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("perl5.61" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("perl5.8.5" . cperl-mode))
I tried to combine these to one line using regexp-opt, e.g.
(regexp-opt "perl5" "perl5.61" "perl5.8.5") which returns
"perl5\\(?:\\.\\(?:61\\|8\\.5\\)\\)?"
which I used to generate
(add-to-list 'interpreter-mode-alist
'("perl5\\(?:\\.\\(?:61\\|8\\.5\\)\\)?" . cperl-mode))
A fresh emacs invocation with only this interpret-mode-alist in its
.emacs doe not invoke cperl-mode as expected when visiting the
perl5.61 and perl5.8.5 files above.
auto-mode-alist doesn't seem to have this restriction, as in this example:
(add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
Thanks,
Andy Scott
In GNU Emacs 21.3.50.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2004-09-21 on chlr4917
configured using `configure '--prefix=/stor/garray/linux'
'--with-x-toolkit=yes'
'--x-includes=/usr/X11R6' '--x-libraries=/usr/X11R6/lib' 'CC=gcc''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: C
locale-coding-system: nil
default-enable-multibyte-characters: t
Major mode: Text
Minor modes in effect:
tool-bar-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
unify-8859-on-encoding-mode: t
utf-translate-cjk-mode: t
line-number-mode: t
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- interpeter-mode-alist should handle regexps like auto-mode-alist,
Andrew M. Scott~ <=