Subject: 25.2; cperl-mode indentation after package BLOCKs

From: Darren Embry <[email-masked]>
Date: Fri, 29 Sep 2017 00:37:00 -0400

Hello GNU Emacs developers,

I'm getting the following automatic indentation in cperl-mode for a
script containing more than one BLOCK:

    #!/usr/bin/env perl
    use warnings;
    use strict;

    package Foo {
      use Moose;
    }
      package Bar {
        use Moose;
      }

      # Local Variables:
      # mode: cperl
      # End:

Package BLOCKs were created in Perl 5.14 as an alternative syntax that
only applies the specified namespace to a BLOCK:

    https://www.perl.com/pub/2011/05/new-features-of-perl-514-package-block.html

Obviously the second package BLOCK in my opinion should be indented the
same as the first:

    package Foo {
      use Moose;
    }
    package Bar {
      use Moose;
    }

With opening braces on their own lines, auto-indentation becomes a
little bit weirder:

    #!/usr/bin/env perl
    use warnings;
    use strict;

    package Foo
      {
        use Moose;
      }
      package Bar
      {
        use Moose;
      }

      # Local Variables:
      # mode: cperl
      # End:

My present workaround is to append a ; to every package BLOCK:

    package Foo {
      use Moose;
    };

I've also discovered another workaround: change the value of
`cperl-continued-statement-offset' to 0.  That may help guide you to
what cperl-mode thinks is going on, as well as where to look for and/or
fix the problem.

Thanks,
Darren

In GNU Emacs 25.2.1 (x86_64-unknown-linux-gnu)
 of 2017-08-03 built on barnacle2.webonastick.com
System Description:	Ubuntu 14.04.4 LTS

Configured using:
 'configure --prefix=/usr/local'

Configured features:
SOUND NOTIFY ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: CPerl

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
next-line: End of buffer
Saving file /home/dse/foo.pl...
Wrote /home/dse/foo.pl
You can run the command ‘normal-mode’ with M-x nor-m RET
Mark set [3 times]
Quit
Saving file /home/dse/foo.pl...
Wrote /home/dse/foo.pl

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode cl-loaddefs pcase
cl-lib mail-prsvr mail-utils cperl-mode easymenu perl-mode regexp-opt
term/xterm xterm time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type tabulated-list newcomment elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote inotify multi-tty
make-network-process emacs)

Memory information:
((conses 16 90853 5234)
 (symbols 48 19556 0)
 (miscs 40 49 124)
 (strings 32 16289 5349)
 (string-bytes 1 483067)
 (vectors 16 10278)
 (vector-slots 8 392683 13537)
 (floats 8 147 274)
 (intervals 56 222 23)
 (buffers 976 19)
 (heap 1024 26088 633))