From: "Harald Jörg" <haj@posteo.de>
To: 72296@debbugs.gnu.org
Cc: brian <me@briang.org>
Subject: bug#72296: 29.4; cperl-mode parsing error
Date: Thu, 25 Jul 2024 19:06:35 +0000 [thread overview]
Message-ID: <87frrxjnpg.fsf@oook.m.uunet.de> (raw)
In-Reply-To: <0c1147f0-9656-4860-ad58-dd1e24b75634@briang.org> (brian's message of "Thu, 25 Jul 2024 14:29:37 +0100")
tags 72296 confirmed
severity 72296 normal
owner 72296 Harald Jörg <haj@posteo.de>
thanks
brian <me@briang.org> writes:
> I started emacs using 'emacs -Q /tmp/some-empty-file.pl' and activated
> cperl mode by 'M-x cperl-mode'. I typed 'for (2..$n/2) {}' into the
> empty buffer and as soon as I pressed '/' there was an error message in
> the minibuffer
>
> End of ‘/ ... /’ string/RE not found: (scan-error Unbalanced
> parentheses 11 38)
>
> and syntax hilighting was broken. Inserting a single space before '$'
> cleared the error and fixed the hilighting.
I can reproduce this and am about to prepare a fix.
That code sits here since 1997, I find it rather surprising that it has
not surfaced until now. I'll run some tests and add a test case. If I
am not mistaken, then replacing a `progn` with `save-excursion` should
do the trick:
index b85db699e72..34481925d3e 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -4108,7 +4108,7 @@ cperl-find-pods-heres
(and (eq (preceding-char) ?\})
(cperl-after-block-p (point-min)))
(and (eq (char-syntax (preceding-char)) ?w)
- (progn
+ (save-excursion
(forward-sexp -1)
;; After these keywords `/' starts a RE. One should add all the
;; functions/builtins which expect an argument, but ...
In newer versions the line numbers are different (~4650) but the issue
is the same. The unprotected (forward-sexp -1) skips over $n and the
two characters before that are '..' which, in the following clause,
makes the construct look like a flip-flop operator where '/' does start
a regular expression. Using 'save-excursion' undoes the skip before
running the next checks.
--
Cheers,
haj
next prev parent reply other threads:[~2024-07-25 19:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-25 13:29 bug#72296: 29.4; cperl-mode parsing error brian
2024-07-25 17:01 ` Andrea Corallo
2024-07-25 19:06 ` Eli Zaretskii
2024-07-26 7:59 ` Andrea Corallo
[not found] ` <20240725183057.dqp2aii5asd5tdgv@dev>
2024-07-26 8:03 ` Andrea Corallo
2024-07-26 10:20 ` Harald Jörg
2024-07-26 10:38 ` Eli Zaretskii
2024-07-25 19:06 ` Harald Jörg [this message]
2024-07-27 8:04 ` Eli Zaretskii
[not found] ` <handler.72296.B.17219262464512.ack@debbugs.gnu.org>
2024-07-26 13:21 ` bug#72296: Acknowledgement (29.4; cperl-mode parsing error) brian greenfield
2024-07-26 13:56 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87frrxjnpg.fsf@oook.m.uunet.de \
--to=haj@posteo.de \
--cc=72296@debbugs.gnu.org \
--cc=me@briang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.