NAME
Text::EmacsColor - syntax-highlight code snippets with Emacs
SYNOPSIS
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.
TODO
auto-detect running emacs and use it
REPOSITORY
http://github.com/jrockway/text-emacscolor
SEE ALSO
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.
AUTHOR
Jonathan Rockway <jrockway@cpan.org>
COPYRIGHT
Copyright 2008 Jonathan Rockway
This module is Free Software, you may redistribute it under the same terms as Perl itself.