简体   繁体   English

Emacs CPerl模式:缩进区域中的错误

[英]Emacs CPerl mode: bug in indent-region

I edit my Perl scripts in Emacs, using CPerl mode. 我使用CPerl模式在Emacs中编辑我的Perl脚本。 But the Emacs function indent-region is broken in that mode. 但是Emacs函数indent-region在该模式下被破坏。 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. 这非常烦人,特别是因为我习惯在变量名中使用下划线,并且我一直按下indent-region的键盘快捷键(实际上,基于它的自定义indent-whole-buffer功能),它已经是自动的。

Does anyone know how to fix it? 有谁知道如何修理它?

I am using this Emacs: 我正在使用这个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 (或类似)之后:

foreach my $num_elements (1,2) {}

becomes: 变为:

foreach my $num_ elements (1,2) {}

Updated versions of cperl-mode are available. 可以使用更新版本的cperl-mode。 The official version and an unofficial version that's aware of 5.10 and Moose . 官方版本非官方版本,知道5.10和Moose Updating to one of those should fix your problem. 更新到其中一个应该可以解决您的问题。

Mx describe-variable cperl-version will show what version of cperl-mode you're using. Mx describe-variable cperl-version将显示您正在使用的cperl-mode的版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM