jrockway / cperl-mode

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

indenting constant blocks without the staircase effect? #32

Open ldeck opened 8 years ago

ldeck commented 8 years ago

I'm using cperl-mode 6.2 with GNU Emacs 24.5.1 (x86_64-apple-darwin15.0.0, NS apple-appkit-1404.11), using prelude starter kit.

A constant block like this:

use constant {
  ONE => 1,
  TWO => 2
};

is formatted like this by cperl:

use constant {
  ONE => 1,
    TWO => 2
  };

I have the following settings:

(defun my-cperl-mode-defaults ()
  (setq cperl-close-paren-offset -2
        cperl-close-brace-offset -2
        cperl-continued-statement-offset 2
        cperl-continued-brace-offset 2
        cperl-fix-hanging-brace-when-indent t
        cperl-indent-level 2
       cperl-indent-parens-as-block t
       cperl-tabs-always-indent t)

  (setq cperl-hairy)
  )

(setq prelude-cperl-mode-hook 'my-cperl-mode-defaults)
(add-hook 'cperl-mode-hook (lambda ()
                             (run-hooks 'prelude-cperl-mode-hook)) t)

This problem seems to have been noted here.

Has it been fixed in a later version? Is there a workaround? Thanks!

renormalist commented 8 years ago

I don't think it is already fixed, as I remember it annoyed me too. If you could take this cperl-mode.el here and prepare the patch from stoackoverflow into a github pull request I am happy to apply it.

renormalist commented 6 years ago

Any contributors? Looks like a doable task, yet I don't have the energy to do and verify...