Skip to content
Browse files

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.
  • Loading branch information...
1 parent 90e9952 commit f06bd14d41ab08d26629fdef91f648b00686e97d @schwern schwern committed Dec 26, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 cperl-mode.el
View
4 cperl-mode.el
@@ -3143,7 +3143,9 @@ and closing parentheses and brackets."
((eq 'continuation (elt i 0))
;; [continuation statement-start char-after is-block is-brace]
(goto-char (elt i 1)) ; statement-start
- (+ (if (memq (elt i 2) (append "}])" nil)) ; char-after
+ (+ (if (or (memq (elt i 2) (append "}])" nil)) ; char-after
+ (eq 'continuation ; do not repeat cperl-close-paren-offset
+ (elt (cperl-sniff-for-indent parse-data) 0)))
0 ; Closing parenth
cperl-continued-statement-offset)
(if (or (elt i 3) ; is-block

0 comments on commit f06bd14

Please sign in to comment.
Something went wrong with that request. Please try again.