more useful options | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I'd consider this indentation of CPerl to be a bug. CPerl mode's M-x indent-region does more than just indent, it also tries to "fix" spacing. But in this case it turns out just horribly wrong. Here's an example to show the intention: If you type the following: if($fee){fie()}else{foe($foo)}...and then process this with M-x indent-region, then you get (depending on your style, I'm using PBP here):
Nifty, eh? A real life saver... but only if your space key is broken. The customization variable responsible for this is cperl-indent-region-fix-constructs (on by default), which is out of the scope of the predefined indentation styles. The documentation for that variable shows what it should do, but not what it actually does. So, if you don't need CPerl mode to reformat your code like this, then I suggest you just turn off that variable as a workaround (and, if you like, write a bug report). By the way: Emacs can help with aligning the keys as suggested by ikegami and GrandFather, unrelated to CPerl mode. It is hardly worth the effort for four lines, though: Mark the assignment as a region, and then
This yields:
In reply to Re: How would you indent this?
by haj
|
|