* bug#74245: 30.0.92; CPerl subroutine signatures are left open when last param is $
@ 2024-11-07 19:19 Peter Oliver
2024-11-07 19:29 ` Peter Oliver
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Peter Oliver @ 2024-11-07 19:19 UTC (permalink / raw)
To: 74245
Perl subroutine signatures can include a variable with no name, just a bare $, to indicate that a parameter should be ignored. If this happens in the last place, CPerl mode in Emacs 30.0.92 mishandles it, and is unable to see the closing ). Consequently, it matches parentheses incorrectly, and misindents subsequent blocks.
I have a test that I will send in as a patch, once I have a bug number.
This issue is not present in Emacs 29.4.
--
Peter Oliver
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#74245: 30.0.92; CPerl subroutine signatures are left open when last param is $
2024-11-07 19:19 bug#74245: 30.0.92; CPerl subroutine signatures are left open when last param is $ Peter Oliver
@ 2024-11-07 19:29 ` Peter Oliver
2024-11-08 12:12 ` Stefan Kangas
2025-01-13 12:00 ` Harald Jörg
2 siblings, 0 replies; 9+ messages in thread
From: Peter Oliver @ 2024-11-07 19:29 UTC (permalink / raw)
To: 74245
[-- Attachment #1: Type: text/plain, Size: 32 bytes --]
Test attached.
--
Peter Oliver
[-- Attachment #2: Type: text/plain, Size: 2298 bytes --]
From b388d1c69051a9f49db129254afc62d2840bcb0f Mon Sep 17 00:00:00 2001
From: Peter Oliver <git@mavit.org.uk>
Date: Thu, 7 Nov 2024 19:22:21 +0000
Subject: [PATCH] ; cperl-mode.el: Add a test for Bug#74245
* test/lisp/progmodes/cperl-mode-resources/cperl-bug-74245.pl: New test data.
* test/lisp/progmodes/cperl-mode-tests.el (cperl-test-bug-74245): Verify
that a bare \"$\" can appear at the end of a subroutine signature.
---
.../cperl-mode-resources/cperl-bug-74245.pl | 16 ++++++++++++++++
test/lisp/progmodes/cperl-mode-tests.el | 9 +++++++++
2 files changed, 25 insertions(+)
create mode 100644 test/lisp/progmodes/cperl-mode-resources/cperl-bug-74245.pl
diff --git a/test/lisp/progmodes/cperl-mode-resources/cperl-bug-74245.pl b/test/lisp/progmodes/cperl-mode-resources/cperl-bug-74245.pl
new file mode 100644
index 00000000000..44d1e49bd36
--- /dev/null
+++ b/test/lisp/progmodes/cperl-mode-resources/cperl-bug-74245.pl
@@ -0,0 +1,16 @@
+# This resource file can be run with cperl--run-testcases from
+# cperl-tests.el and works with both perl-mode and cperl-mode.
+
+# -------- signature where last parameter is ignored: input -------
+package P {
+use v5.36;
+sub ignore ($first, $) {}
+ignore(qw(first second));
+}
+# -------- signature where last parameter is ignored: expected output -------
+package P {
+ use v5.36;
+ sub ignore ($first, $) {}
+ ignore(qw(first second));
+}
+# -------- signature where last parameter is ignored: end -------
diff --git a/test/lisp/progmodes/cperl-mode-tests.el b/test/lisp/progmodes/cperl-mode-tests.el
index 7a6e0b3b64a..625c41cf52c 100644
--- a/test/lisp/progmodes/cperl-mode-tests.el
+++ b/test/lisp/progmodes/cperl-mode-tests.el
@@ -1590,6 +1590,15 @@ cperl-test-bug-72296
(should (equal (nth 8 (cperl-test-ppss code "/")) 9)))
)
+(ert-deftest cperl-test-bug-74245 ()
+ "Verify that a bare \"$\" can appear at the end of a subroutine signature.
+It must not be mistaken for \"$)\"."
+ (cperl--run-test-cases
+ (ert-resource-file "cperl-bug-74245.pl")
+ (while (null (eobp))
+ (cperl-indent-command)
+ (forward-line 1))))
+
(ert-deftest test-indentation ()
(ert-test-erts-file (ert-resource-file "cperl-indents.erts")))
--
2.47.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* bug#74245: 30.0.92; CPerl subroutine signatures are left open when last param is $
2024-11-07 19:19 bug#74245: 30.0.92; CPerl subroutine signatures are left open when last param is $ Peter Oliver
2024-11-07 19:29 ` Peter Oliver
@ 2024-11-08 12:12 ` Stefan Kangas
2025-01-02 2:05 ` Stefan Kangas
2025-01-12 0:34 ` Harald Jörg
2025-01-13 12:00 ` Harald Jörg
2 siblings, 2 replies; 9+ messages in thread
From: Stefan Kangas @ 2024-11-08 12:12 UTC (permalink / raw)
To: Peter Oliver, 74245; +Cc: Harald Jörg
Peter Oliver <p.d.oliver@mavit.org.uk> writes:
> Perl subroutine signatures can include a variable with no name, just a bare $, to indicate that a parameter should be ignored. If this happens in the last place, CPerl mode in Emacs 30.0.92 mishandles it, and is unable to see the closing ). Consequently, it matches parentheses incorrectly, and misindents subsequent blocks.
>
> I have a test that I will send in as a patch, once I have a bug number.
>
> This issue is not present in Emacs 29.4.
Harald, could you please take a look at this?
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#74245: 30.0.92; CPerl subroutine signatures are left open when last param is $
2024-11-08 12:12 ` Stefan Kangas
@ 2025-01-02 2:05 ` Stefan Kangas
2025-01-12 0:34 ` Harald Jörg
1 sibling, 0 replies; 9+ messages in thread
From: Stefan Kangas @ 2025-01-02 2:05 UTC (permalink / raw)
To: Peter Oliver; +Cc: Harald Jörg, 74245
Stefan Kangas <stefankangas@gmail.com> writes:
> Peter Oliver <p.d.oliver@mavit.org.uk> writes:
>
>> Perl subroutine signatures can include a variable with no name, just a bare $,
>> to indicate that a parameter should be ignored. If this happens in the last
>> place, CPerl mode in Emacs 30.0.92 mishandles it, and is unable to see the
>> closing ). Consequently, it matches parentheses incorrectly, and misindents
>> subsequent blocks.
>>
>> I have a test that I will send in as a patch, once I have a bug number.
>>
>> This issue is not present in Emacs 29.4.
>
> Harald, could you please take a look at this?
Friendly ping.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#74245: 30.0.92; CPerl subroutine signatures are left open when last param is $
2024-11-08 12:12 ` Stefan Kangas
2025-01-02 2:05 ` Stefan Kangas
@ 2025-01-12 0:34 ` Harald Jörg
1 sibling, 0 replies; 9+ messages in thread
From: Harald Jörg @ 2025-01-12 0:34 UTC (permalink / raw)
To: Stefan Kangas; +Cc: Peter Oliver, 74245
Stefan Kangas <stefankangas@gmail.com> writes:
> Peter Oliver <p.d.oliver@mavit.org.uk> writes:
>
>> Perl subroutine signatures can include a variable with no name, just
>> a bare $, to indicate that a parameter should be ignored. If this
>> happens in the last place, CPerl mode in Emacs 30.0.92 mishandles
>> it, and is unable to see the closing ). Consequently, it matches
>> parentheses incorrectly, and misindents subsequent blocks.
>>
>> I have a test that I will send in as a patch, once I have a bug number.
>>
>> This issue is not present in Emacs 29.4.
>
> Harald, could you please take a look at this?
I apologize, for some reason this bug report slipped by me. I'll have a
look next week. I can reproduce the bug.
On first glance, there's a workaround: Add a trailing comma to the
parameter list. Ugly, but prevents the indentation from being messed up:
sub ignore ($first, $,) {}
--
Cheers,
haj
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#74245: 30.0.92; CPerl subroutine signatures are left open when last param is $
2024-11-07 19:19 bug#74245: 30.0.92; CPerl subroutine signatures are left open when last param is $ Peter Oliver
2024-11-07 19:29 ` Peter Oliver
2024-11-08 12:12 ` Stefan Kangas
@ 2025-01-13 12:00 ` Harald Jörg
2025-01-13 12:44 ` Peter Oliver
2025-01-13 13:22 ` Eli Zaretskii
2 siblings, 2 replies; 9+ messages in thread
From: Harald Jörg @ 2025-01-13 12:00 UTC (permalink / raw)
To: Peter Oliver; +Cc: 74245
Peter Oliver <p.d.oliver@mavit.org.uk> writes:
> Perl subroutine signatures can include a variable with no name, just a
> bare $, to indicate that a parameter should be ignored. If this
> happens in the last place, CPerl mode in Emacs 30.0.92 mishandles it,
> and is unable to see the closing ). Consequently, it matches
> parentheses incorrectly, and misindents subsequent blocks.
>
> I have a test that I will send in as a patch, once I have a bug number.
>
> This issue is not present in Emacs 29.4.
Thank you for the report and for the test!
This is now fixed in the emacs-30 branch.
I would very much like to add the test and resource file as well. Do we
need to do the copyright paperwork?
--
Cheers,
haj
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#74245: 30.0.92; CPerl subroutine signatures are left open when last param is $
2025-01-13 12:00 ` Harald Jörg
@ 2025-01-13 12:44 ` Peter Oliver
2025-01-13 16:17 ` Harald Jörg
2025-01-13 13:22 ` Eli Zaretskii
1 sibling, 1 reply; 9+ messages in thread
From: Peter Oliver @ 2025-01-13 12:44 UTC (permalink / raw)
To: Harald Jörg; +Cc: 74245
[-- Attachment #1: Type: text/plain, Size: 323 bytes --]
On Mon, 13 Jan 2025, Harald Jörg wrote:
> Peter Oliver <p.d.oliver@mavit.org.uk> writes:
>
>> I have a test that I will send in as a patch, once I have a bug number.
>
> I would very much like to add the test and resource file as well. Do we
> need to do the copyright paperwork?
The paperwork is done.
--
Peter Oliver
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#74245: 30.0.92; CPerl subroutine signatures are left open when last param is $
2025-01-13 12:00 ` Harald Jörg
2025-01-13 12:44 ` Peter Oliver
@ 2025-01-13 13:22 ` Eli Zaretskii
1 sibling, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2025-01-13 13:22 UTC (permalink / raw)
To: Harald Jörg; +Cc: p.d.oliver, 74245
> Cc: 74245@debbugs.gnu.org
> From: Harald Jörg <haj@posteo.de>
> Date: Mon, 13 Jan 2025 12:00:24 +0000
>
> I would very much like to add the test and resource file as well. Do we
> need to do the copyright paperwork?
Peter's assignment is on file, so we are okay in that department.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#74245: 30.0.92; CPerl subroutine signatures are left open when last param is $
2025-01-13 12:44 ` Peter Oliver
@ 2025-01-13 16:17 ` Harald Jörg
0 siblings, 0 replies; 9+ messages in thread
From: Harald Jörg @ 2025-01-13 16:17 UTC (permalink / raw)
To: Peter Oliver; +Cc: 74245
close 74245 30.0
thanks
Peter Oliver <p.d.oliver@mavit.org.uk> writes:
> On Mon, 13 Jan 2025, Harald Jörg wrote:
>
>> Peter Oliver <p.d.oliver@mavit.org.uk> writes:
>>
>>> I have a test that I will send in as a patch, once I have a bug number.
>>
>> I would very much like to add the test and resource file as well. Do we
>> need to do the copyright paperwork?
>
> The paperwork is done.
Excellent! I committed the test (thanks again!) and close the bug now.
--
Cheers,
haj
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-01-13 16:17 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-07 19:19 bug#74245: 30.0.92; CPerl subroutine signatures are left open when last param is $ Peter Oliver
2024-11-07 19:29 ` Peter Oliver
2024-11-08 12:12 ` Stefan Kangas
2025-01-02 2:05 ` Stefan Kangas
2025-01-12 0:34 ` Harald Jörg
2025-01-13 12:00 ` Harald Jörg
2025-01-13 12:44 ` Peter Oliver
2025-01-13 16:17 ` Harald Jörg
2025-01-13 13:22 ` Eli Zaretskii
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).