GNU bug report logs - #19709
Problem with indentation for the closing parenthesis in cperl-mode version 6.1

Previous Next

Package: emacs;

Reported by: Håkon Hægland <hakon.hagland <at> gmail.com>

Date: Wed, 28 Jan 2015 07:31:02 UTC

Severity: minor

Tags: confirmed, fixed

Found in version 26.2

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 19709 in the body.
You can then email your comments to 19709 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#19709; Package emacs. (Wed, 28 Jan 2015 07:31:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Håkon Hægland <hakon.hagland <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 28 Jan 2015 07:31:03 GMT) Full text and rfc822 format available.

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

From: Håkon Hægland <hakon.hagland <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Problem with indentation for the closing parenthesis in cperl-mode
 version 6.1
Date: Wed, 28 Jan 2015 08:30:05 +0100
[Message part 1 (text/plain, inline)]
I have problems with correct alignment of the closing parenthesis in
cperl-mode. For example consider the following Perl code:

my $a = func1(
    Module::test()
  );

my $b = func2(
    test()
);

my $c = func3(
    Module::test(),
);
We see that the closing parenthesis is not correctly indented for func1,
but for func2 and func3 it is correct.

In cperl-mode-hook I have

(setq cperl-indent-level 4)
(setq cperl-indent-parens-as-block t)
(setq cperl-close-paren-offset -4)

It seems to me that this behavior is related to the newest version of
cperl-mode. I am using Emacs 24.4 on Ubuntu 14.04, and the cperl-mode that
came with the installation
(/opt/emacs24.4/share/emacs/24.4/lisp/progmodes/cperl-mode.el.gz) is
version 6.1 of cperl-mode.

I then tried to install cperl-mode from ELPA using Emacs 24.4 package
manager (list-packages), and it turned out that it gave me version 5.23 of
cperl-mode which also indented the closing parenthesis correctly..

M-x emacs-version:

GNU Emacs 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8) of
2015-01-11 on hakon-ThinkPad-Edge-E540

I built Emacs 24.4.1 from source, using with `--with-xft` option to
configure.

Best regards,
Håkon Hægland
[Message part 2 (text/html, inline)]

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

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Håkon Hægland <hakon.hagland <at> gmail.com>
Cc: 19709 <at> debbugs.gnu.org
Subject: Re: bug#19709: Problem with indentation for the closing parenthesis
 in cperl-mode version 6.1
Date: Fri, 5 Jul 2019 22:14:06 +0200
Håkon Hægland <hakon.hagland <at> gmail.com> writes:

> I have problems with correct alignment of the closing parenthesis in cperl-mode. For example consider the following Perl code:
>
> my $a = func1(
>     Module::test()
>   );
>
> my $b = func2(
>     test()
> );
>
> my $c = func3(
>     Module::test(),
> );
> We see that the closing parenthesis is not correctly indented for func1, but for func2 and func3 it is correct.
>
> In cperl-mode-hook I have
>
> (setq cperl-indent-level 4)
> (setq cperl-indent-parens-as-block t)
> (setq cperl-close-paren-offset -4)
>
> It seems to me that this behavior is related to the newest version of cperl-mode. I am using Emacs 24.4 on Ubuntu 14.04, and the cperl-mode that came with the installation (/opt/emacs24.4/share/emacs/24.4/lisp/progmodes/cperl-mode.el.gz) is version 6.1
> of cperl-mode.
>
> I then tried to install cperl-mode from ELPA using Emacs 24.4 package manager (list-packages), and it turned out that it gave me version 5.23 of cperl-mode which also indented the closing parenthesis correctly..

I can reproduce this on Emacs 26.2.

BTW, the problem goes away when I set:

  (setq cperl-label-offset 0)

But of course you shouldn't have to do that.

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:03 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:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19709; Package emacs. (Wed, 04 Nov 2020 20:02:01 GMT) Full text and rfc822 format available.

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

From: haj <at> posteo.de (Harald Jörg)
To: 19709 <at> debbugs.gnu.org
Subject: [PATCH] Verify that indentation works with current cperl-mode
Date: Wed, 04 Nov 2020 21:01:33 +0100
[Message part 1 (text/plain, inline)]
This bug apparently can no longer be reproduced.

Using quick'n'dirty bisection (avoiding recompilations of the whole
source tree) I could track the fix back to commit 1bcbcb7e,
"lisp/progmodes/cperl-mode.el: Merge from Jonathan Rockway's version" by
Stefan Monnier, 21st Dec 2017.  This makes sense since this commit
introduced a new function 'cperl-calculate-indent' to cperl-mode.el.

The patch adds a test to verify correct behavior, and also adds the
relevant variable cperl-close-paren-offset (which is explicitly set in
the bug report) to the scope of the cperl-set-style setting "PBP".  This
variable is documented in the book, but wasn't included yet.
--
Cheers,
haj

[0001-cperl-mode-Indentation-of-follows-customisation.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19709; Package emacs. (Mon, 09 Nov 2020 14:29:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: haj <at> posteo.de (Harald Jörg)
Cc: 19709 <at> debbugs.gnu.org
Subject: Re: bug#19709: [PATCH] Verify that indentation works with current
 cperl-mode
Date: Mon, 09 Nov 2020 15:28:08 +0100
haj <at> posteo.de (Harald Jörg) writes:

> The patch adds a test to verify correct behavior, and also adds the
> relevant variable cperl-close-paren-offset (which is explicitly set in
> the bug report) to the scope of the cperl-set-style setting "PBP".  This
> variable is documented in the book, but wasn't included yet.

Thanks; applied to Emacs 28.  One note:

> +            (while (null (eobp))
> +              (cperl-indent-command)
> +              (next-line))

Is this on purpose to test `next-line'?   If it is, this warning should
probably be inhibited:

lisp/progmodes/cperl-mode-tests.el:284:16: Warning: ‘next-line’ is for
    interactive use only; use ‘forward-line’ instead.

If not, forward-line should be used.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 09 Nov 2020 14:29:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 19709 <at> debbugs.gnu.org and Håkon Hægland <hakon.hagland <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 09 Nov 2020 14:29:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19709; Package emacs. (Mon, 09 Nov 2020 16:07:01 GMT) Full text and rfc822 format available.

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

From: haj <at> posteo.de (Harald Jörg)
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 19709 <at> debbugs.gnu.org
Subject: Re: bug#19709: [PATCH] Verify that indentation works with current
 cperl-mode
Date: Mon, 09 Nov 2020 17:06:06 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> [...]
> Thanks; applied to Emacs 28.  One note:
>
>> +            (while (null (eobp))
>> +              (cperl-indent-command)
>> +              (next-line))
>
> Is this on purpose to test `next-line'?   If it is, this warning should
> probably be inhibited:
> 
> lisp/progmodes/cperl-mode-tests.el:284:16: Warning: ‘next-line’ is for
>     interactive use only; use ‘forward-line’ instead.

Nah - that's still me fighting with Emacs Lisp vocabulary.  Sorry for
that.  I'll replace it with (forward-line 1).

I should submit a patch anyway since I've found that the usage of
setq-local for a list of variables isn't available in Emacs 26, and I
want to run the tests in that version, too.

--
Thanks for reminding me,
haj




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19709; Package emacs. (Tue, 10 Nov 2020 13:57:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: haj <at> posteo.de (Harald Jörg)
Cc: 19709 <at> debbugs.gnu.org
Subject: Re: bug#19709: [PATCH] Verify that indentation works with current
 cperl-mode
Date: Tue, 10 Nov 2020 14:56:24 +0100
haj <at> posteo.de (Harald Jörg) writes:

> Nah - that's still me fighting with Emacs Lisp vocabulary.  Sorry for
> that.  I'll replace it with (forward-line 1).
>
> I should submit a patch anyway since I've found that the usage of
> setq-local for a list of variables isn't available in Emacs 26, and I
> want to run the tests in that version, too.

Sounds good.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 09 Dec 2020 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 132 days ago.

Previous Next


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