I have a system where I mix XML and Perl code together. I use XML mode for the most part, which gives me decent syntax highlighting for the XML portions. If the Perl starts getting bigger, I might switch the buffer the cperl-mode. That doesn't quite work, since there's enough non-Perl stuff in the buffer to confuse the parser.
Is there a good way to have it all? (Simple) XML syntax highlighting for the XML portions, and cperl-mode only on the Perl portions? It's not completely straightforward to pull them apart, but I can write some elisp if need be.
Note about the title: when contemplating how to label this post, I didn't really feel like it was off-topic, exactly. So although this post may not be entirely on-topic, at least I winged it pretty good.
I work for Reactrix Systems, and am willing to admit it.
Re: [WT] Perl mode in mixed emacs buffer
by mugwumpjism (Hermit) on Jul 19, 2005 at 04:19 UTC
|
You probably want mmm-mode
Install and load the mmm-mode library, then use the mmm-ify-by-regexp command to turn it on for a buffer. Set to a hotkey or something if you want to be able to do it quickly after you load a file.
Eg, one I used for Parse::ePerl:
(mmm-ify-by-regexp 'cperl-mode "<[\?]" 0 "[\?][\>]" 0 2)
$h=$ENV{HOME};my@q=split/\n\n/,`cat $h/.quotes`;$s="$h/."
."signature";$t=`cat $s`;print$t,"\n",$q[rand($#q)],"\n";
| [reply] [d/l] [select] |
|
|
I second the mmm-mode. It works for Perl-mason as well as javascript embedded in HTML.
Take time to read the documentation, though, cause there's a lot you can do with mmm-mode but, as with all things Emacs, can take a fair bit of learning to take full control of..
| [reply] |
Re: [WT] Perl mode in mixed emacs buffer
by ysth (Canon) on Jul 19, 2005 at 04:01 UTC
|
Maybe figure out a way to have a =pod near the top and =cut/=pod around big blocks of perl?
BTW, I couldn't figure out what the [WT] in your title meant. | [reply] [d/l] |