Text::EmacsColor - syntax-highlight code snippets with Emacs
my $colorer = Text::EmacsColor->new; my $html = $colorer->format( 'my $foo = 42', # code 'cperl', # the emacs mode to use (cperl, lisp, haskell, ...) );
By default, emacs will exec in --batch mode. If you want to use emacsclient or pass other options to emacs, specify the emacs_command initarg:
my $colorer = Text::EmacsColor->new( emacs_command => 'emacsclient --eval' );
Note that $html, the return value of format, is an instance of Text::EmacsColor::Result. It stringifies to the HTML-ified text that emacs returns, but also provides other functionality. See Text::EmacsColor::Result for more details.
$html
format
auto-detect running emacs and use it
http://github.com/jrockway/text-emacscolor
Text::VimColor
Emacs' highlighting is way better, but this is where I got the name from.
My cperl-mode is the most up-to-date Perl highligher for emacs; get it from http://github.com/jrockway/cperl-mode.
cperl-mode
Jonathan Rockway <jrockway@cpan.org>
<jrockway@cpan.org>
Copyright 2008 Jonathan Rockway
This module is Free Software, you may redistribute it under the same terms as Perl itself.
To install Text::EmacsColor, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::EmacsColor
CPAN shell
perl -MCPAN -e shell install Text::EmacsColor
For more information on module installation, please visit the detailed CPAN module installation guide.