Patch continued statement indentation when inside a block. #12

Merged
merged 1 commit into from Jan 18, 2013

Conversation

Projects
None yet
2 participants
Contributor

schwern commented Dec 27, 2012

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.

@schwern schwern Patch indentation of continued statements inside a block.
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.
f06bd14

@jrockway jrockway added a commit that referenced this pull request Jan 18, 2013

@jrockway jrockway Merge pull request #12 from schwern/master
Patch continued statement indentation when inside a block.
5451306

@jrockway jrockway merged commit 5451306 into jrockway:master Jan 18, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment