Subject: bug#16368: [PATCH] cperl-mode: don't freeze over a cool regexp

From: Stefan Kangas <[email-masked]>
Date: Wed, 2 Sep 2020 18:19:25 -0400

Harald Jörg <[email-masked]> writes:

> Patch attached, including two test cases.

Thanks for working on cperl-mode bugs.

Testing the original recipe with your patch it is already an improvement
in that it avoids the freeze.  But I see these messages:

  cperl-forward-group-in-re: error (scan-error Unbalanced parentheses 9 94)
  (scan-error Unbalanced parentheses 9 94)

Is that the expected and desired behavior?

---

Also, some minor nits:

> Subject: [PATCH] =?UTF-8?q?2020-09-02=20=20Harald=20J=C3=B6rg=20=20<haj@po?=
>  =?UTF-8?q?steo.de>?=

Better first line:

Fix freeze in cperl-mode when editing a regexp

>  * lisp/progmodes/cperl-mode.el (cperl-forward-group-in-re): Make
>  sure that an error is reported back to the caller (Bug#16368).
>
>  * test/lisp/progmodes/cperl-mode-tests.el (cperl-mode-test-bug-16368):
>  Tests for balanced (no error) and unbalanced (caught exception)
>  cases of `cperl-forward-group-in-re'.

Format these flush to the first column (no initial space).

> --- a/test/lisp/progmodes/cperl-mode-tests.el
> +++ b/test/lisp/progmodes/cperl-mode-tests.el

I see this:

    ELC      lisp/progmodes/cperl-mode-tests.elc

  In end of data:
  lisp/progmodes/cperl-mode-tests.el:73:1: Warning: the function
      `cperl-forward-group-in-re' is not known to be defined.

You should add this line to the top:

  (require 'cperl-mode)

Best regards,
Stefan Kangas