GNU bug report logs - #28640
25.2; cperl-mode indentation after package BLOCKs

Previous Next

Package: emacs;

Reported by: Darren Embry <dse <at> webonastick.com>

Date: Fri, 29 Sep 2017 04:37:02 UTC

Severity: minor

Tags: confirmed

Merged with 42169

Found in versions 25.2, 26.1, 26.2

Done: Harald Jörg <haj <at> posteo.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28640 in the body.
You can then email your comments to 28640 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#28640; Package emacs. (Fri, 29 Sep 2017 04:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Darren Embry <dse <at> webonastick.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 29 Sep 2017 04:37:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Darren Embry <dse <at> webonastick.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.2; cperl-mode indentation after package BLOCKs
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))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28640; Package emacs. (Fri, 05 Jul 2019 20:22:01 GMT) Full text and rfc822 format available.

Message #8 received at 28640 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: 28640 <at> debbugs.gnu.org
Subject: Re: bug#28640: 25.2; cperl-mode indentation after package BLOCKs
Date: Fri, 5 Jul 2019 22:20:52 +0200
Darren Embry <dse <at> webonastick.com> writes:

> 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:

I can reproduce this on Emacs 26.2 and current master.

Best regards,
Stefan Kangas




Added tag(s) confirmed. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Fri, 23 Aug 2019 06:40:04 GMT) Full text and rfc822 format available.

bug Marked as found in versions 26.2. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Fri, 23 Aug 2019 06:40:04 GMT) Full text and rfc822 format available.

Forcibly Merged 28640 42169. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 26 Aug 2020 15:59:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 20 Jul 2023 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 295 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.