jrockway / cperl-mode

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

Indent issue with qw() #53

Closed lamboley closed 4 years ago

lamboley commented 4 years ago

Hi

I have emacs 26.3 running on windows with cperl-mode 6.2 from your last commit on this repo. I have the following configuration :

(setq-default tab-width 4)
(setq-default indent-tabs-mode nil)
(setq cperl-indent-level 4)
(setq cperl-indent-parens-as-block t)
(setq cperl-close-paren-offset -4)
(setq cperl-continued-statement-offset 4)
(setq cperl-tab-always-indent t)
(setq cperl-fix-hanging-brace-when-indent t)
(setq cperl-indent-subs-specially nil)

When I initialize an array with qw(), it give me the following indent :

my @toto = qw(
                 toto
                 tutu
         );

Same for :

my @tutu = qw[
                 tata
                 titi
         ];

or even :

use constant CR => qw(
                         87800
                         76400
                         80200
                         81000
                 );

This is not my guideline. Is it a normal behavior or a bug ? Is there a variable which take care of this case ? What I would like should be :

my @toto = qw(
    toto
    tutu
);

and

my @tutu = qw[
    tata
    titi
];

and

use constant CR => qw(
    87800
    76400
    80200
    81000
);

I started emacs a week ago, I am not fluent enough in elisp to find a fix myself ATM.

hakonhagland commented 4 years ago

Added a quick fix, see pull #54. To test it do:

(setq cperl-indentable-indent nil)
lamboley commented 4 years ago

The fix from #54 works for me.

renormalist commented 4 years ago

@hakonhagland Thanks for the patch and @lamboley thanks for testing it. I just merged it, admittedly without testing by myself but it looks reasonable.

I let you decide about closing this issue if it works as expected.