1
votes

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 indent-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) {}
1
Could you add your version numbers? It works in my GNU Emacs 23.1.1 (i686-pc-linux-gnu, GTK+ Version 2.16.6). - Svante
@Svante: Okay, added it above. - Frank

1 Answers

4
votes

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.