Emacs CPerl mode: bug in indent-region
I edit my Perl scripts in Emacs, using CPerl
mode. But the Emacs function indent-region
is broken in that mode. If I have a variable:
my $num_elements;
it becomes
my $num_ elements;
It's very annoying, especially since I am used to using underscores in variable names, and I press the keyboard shortcut for indent-region
all the time (actually, a custom inde开发者_如何学运维nt-whole-buffer
function based on it), it's already automatic.
Does anyone know how to fix it?
I am using this Emacs:
GNU Emacs 21.4.1 (x86_64-redhat-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2007-12-10 on hs20-bc1-5.build.redhat.com
UPDATE: Actually this happens only after a foreach
(or similar):
foreach my $num_elements (1,2) {}
becomes:
foreach my $num_ elements (1,2) {}
Updated versions of cperl-mode are available. The official version and an unofficial version that's aware of 5.10 and Moose. Updating to one of those should fix your problem.
M-x describe-variable cperl-version
will show what version of cperl-mode you're using.
精彩评论