From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Harald =?UTF-8?Q?J=C3=B6rg?= Newsgroups: gmane.emacs.bugs Subject: bug#72296: 29.4; cperl-mode parsing error Date: Thu, 25 Jul 2024 19:06:35 +0000 Message-ID: <87frrxjnpg.fsf@oook.m.uunet.de> References: <0c1147f0-9656-4860-ad58-dd1e24b75634@briang.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32199"; mail-complaints-to="usenet@ciao.gmane.io" Cc: brian To: 72296@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 25 21:07:23 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sX3oA-0008EA-7a for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 25 Jul 2024 21:07:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sX3nw-0003XZ-Ft; Thu, 25 Jul 2024 15:07:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sX3nj-0003WF-N3 for bug-gnu-emacs@gnu.org; Thu, 25 Jul 2024 15:06:56 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sX3nj-0006Ac-FB for bug-gnu-emacs@gnu.org; Thu, 25 Jul 2024 15:06:55 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sX3nq-0004gj-6i for bug-gnu-emacs@gnu.org; Thu, 25 Jul 2024 15:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Harald =?UTF-8?Q?J=C3=B6rg?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 25 Jul 2024 19:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72296 X-GNU-PR-Package: emacs Original-Received: via spool by 72296-submit@debbugs.gnu.org id=B72296.172193441417985 (code B ref 72296); Thu, 25 Jul 2024 19:07:02 +0000 Original-Received: (at 72296) by debbugs.gnu.org; 25 Jul 2024 19:06:54 +0000 Original-Received: from localhost ([127.0.0.1]:37792 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sX3ni-0004fz-0I for submit@debbugs.gnu.org; Thu, 25 Jul 2024 15:06:54 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:46405) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sX3nf-0004fa-1Q for 72296@debbugs.gnu.org; Thu, 25 Jul 2024 15:06:52 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 7BF12240101 for <72296@debbugs.gnu.org>; Thu, 25 Jul 2024 21:06:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1721934397; bh=fCmZReDY4vEZuxtws6L+94yRlgg1Z9Cq4kV5/kPh5Ro=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:From; b=GKlfqQnbwQmIf2SAxvFK+Rzye5MDZEW3LJkiKRc39neVVj7csog2W8gQzDFoR5JH0 1VT8/yB7460/Q1muqR0ElDiRCybcO6FXbpwRt2lhBMRYLQOYAcI/U9jaWCRLI2sSua 76lV42IWWvyEUjaXkwMkVVKvleTAgOOHNOMlqRQf433ntb1Xa6OSvoDWKSKtShe+hh mi/c5jR+dkZIKogz9wJlemALNZWOarK2kWpi8gjb01FWqQehvwfELOXmqGI1TsUCUC O2EeNjDMXlQlDs3h1CX2Ji6oWKIyKXwZEGWm7gh8XT5OBa0Tfx+0OpIh0MZ3bUeQNO CF6ggrq2NPzdQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4WVL301KMwz9rxB; Thu, 25 Jul 2024 21:06:36 +0200 (CEST) In-Reply-To: <0c1147f0-9656-4860-ad58-dd1e24b75634@briang.org> (brian's message of "Thu, 25 Jul 2024 14:29:37 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:289336 Archived-At: tags 72296 confirmed severity 72296 normal owner 72296 Harald J=C3=B6rg thanks brian 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 =E2=80=98/ ... /=E2=80=99 string/RE not found: (scan-error Unbalan= ced > 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. --=20 Cheers, haj