perl - How do I keep braces from moving in Emacs cperl mode? -


i'm using gnu emacs 22.2.1 , cperl 5.23.

i have perl code this:

sub foo {     if($x)     {       print "x";     }     else     {       print "y";     } } 

i'd reindent code 2-space indent. when run cperl-indent-region on code, get:

sub foo   {     if ($x) {       print "x";     } else {       print "y";     }   } 
  1. how can keep outer brace @ left margin / column 0?
  2. how can prevent opening brace if , else moving previous line?

i believe customization you're looking is:

(setq cperl-extra-newline-before-brace t       cperl-brace-offset              -2       cperl-merge-trailing-else        nil) 

you can customize cperl mode m-x customize-group <enter> cperl <enter>. indentation variables in cperl indentation details subgroup.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -