Search code examples
perlemacsindentationcperl-mode

Emacs indent issue with qw keyword


I have Emacs 26.3 running on windows with cperl-mode 6.2 from the last commit of the cperl-mode repository of jrockway.

I have the following configuration for Emacs :

(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 gives me the following :

my @toto = qw(
                 toto
                 tutu
         );

my @tutu = qw[
                 tata
                 titi
         ];

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

This is not my guideline since I am following the 80 character rule ... I do not know if it's a normal behavior or a bug. I have tried multiple configuration, looked at customize-group of cperl, but I can't find a way to make what I want. Here is what I would like to do :

my @toto = qw(
    toto
    tutu
);

my @tutu = qw[
    tata
    titi
];

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

Anyone has an idea or an Elisp hack to do that ?

Thank you for your help :)


Solution

  • Solved by https://github.com/jrockway/cperl-mode/pull/54 from @HåkonHægland.