jrockway / cperl-mode

cperl-mode with 5.10 fixes, mx-declare support, perl6 support, etc.
102 stars 33 forks source link

Patch continued statement indentation when inside a block. #12

Closed schwern closed 11 years ago

schwern commented 11 years ago

See http://stackoverflow.com/a/14043345/14660 for discussion and original patch. The patch is by http://stackoverflow.com/users/850781/sds The staircase bug is also discussed on the EmacsWiki.

For example, with this in .emacs

(setq cperl-indent-level 4 ; 4 character indents cperl-indent-parens-as-block t ; indent parens like blocks cperl-continued-statement-offset 2 cperl-continued-brace-offset 0 cperl-close-paren-offset -4 cperl-tabs-always-indent nil )

Without the patch it indents like this.

role { has foo => is => 'rw', isa => 'Int', default => 0; }

With the patch it indents correctly.

role { has foo => is => 'rw', isa => 'Int', default => 0; }

Note the presense of a block around the statement is necessary. Without the block the bug does not appear.