From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#72296: 29.4; cperl-mode parsing error Date: Sat, 27 Jul 2024 11:04:15 +0300 Message-ID: <86y15n1csg.fsf@gnu.org> References: <0c1147f0-9656-4860-ad58-dd1e24b75634@briang.org> <87frrxjnpg.fsf@oook.m.uunet.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3825"; mail-complaints-to="usenet@ciao.gmane.io" Cc: me@briang.org, 72296-done@debbugs.gnu.org To: Harald =?UTF-8?Q?J=C3=B6rg?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 27 10:05:04 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 1sXcQJ-0000pZ-E5 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 27 Jul 2024 10:05:03 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sXcQD-0002KX-3j; Sat, 27 Jul 2024 04:04:57 -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 1sXcQA-0002Js-U1 for bug-gnu-emacs@gnu.org; Sat, 27 Jul 2024 04:04:54 -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 1sXcQ9-0008Lw-2W for bug-gnu-emacs@gnu.org; Sat, 27 Jul 2024 04:04:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-version:References:In-Reply-To:From:Date:To:Subject; bh=UdcAQOy0h+kFnx8RRCRM3KcO4SWH+76CanymwN23MuQ=; b=LbKMit5B7Eu9lMBxkCK3cqARhPtAXIM99CNfamDDrcG38LpmgRYK7Vm3nsE/3IGimapf7uGzeQnqJ3L5H/mxojqyWb10UODRkpoU/KLcQi4fdNqwNEoGJmSEdnIAA2z02HLvNP9wleUZvJ9PLFoUeGerxY0yF9kp49UepYHzN/sDYCMsimbnX1ZsTN94np4/EkAnm2QmeU+WN+M2ySEgwokPCwyVREllBlp9KAblmIBAKoZLZEEva/SkKXxDH0lSdKfj5ApK2u5RSdukIPiShp+1c7Mmr0Wu+UyLzxRuWg06/Xi5I9XYuy1IHZV6hv5ptVrDrFtckOUCt0pLEWTFmQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sXcQI-0007Eq-IE; Sat, 27 Jul 2024 04:05:02 -0400 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org, Harald =?UTF-8?Q?J=C3=B6rg?= Resent-Date: Sat, 27 Jul 2024 08:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 72296 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Mail-Followup-To: 72296@debbugs.gnu.org, eliz@gnu.org, me@briang.org Original-Received: via spool by 72296-done@debbugs.gnu.org id=D72296.172206747727751 (code D ref 72296); Sat, 27 Jul 2024 08:05:02 +0000 Original-Received: (at 72296-done) by debbugs.gnu.org; 27 Jul 2024 08:04:37 +0000 Original-Received: from localhost ([127.0.0.1]:40492 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sXcPt-0007D1-0w for submit@debbugs.gnu.org; Sat, 27 Jul 2024 04:04:37 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:35712) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sXcPq-0007Bj-2C for 72296-done@debbugs.gnu.org; Sat, 27 Jul 2024 04:04:35 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sXcPa-0008IW-09; Sat, 27 Jul 2024 04:04:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=UdcAQOy0h+kFnx8RRCRM3KcO4SWH+76CanymwN23MuQ=; b=AvBxPohGuCjfJQvqcG3Y b2YEeMKGfufAZLrEn5vDCVs869OIeUDyGr4TgR/WafQ+0nT/Cdfmu0LaWaFUWBtkLTpEeuiY9MRTv kGSNpKDcEAvoDRV+pRrFGonajNeSFofNAvtUL8rr9ADhry6sAxcaMLrsbegIdj/nAah+GOcrGgQSX gdUk20sEuBH2GHYMpWmYPfn5m2/YIJZltu47TMemRBwwQHV4ftMDJ1kCjSDNVyOYzltaJtmOvc5Gq H4V4MDZssXMe9OTKRhGwF9yK/RDyqhXx+CADXskE0Wz2ebby0aJoubvhLjyUV1ZPMmePjZZ9Mpiug t0+FvI5RBvybsQ==; In-Reply-To: <87frrxjnpg.fsf@oook.m.uunet.de> (message from Harald =?UTF-8?Q?J=C3=B6rg?= on Thu, 25 Jul 2024 19:06:35 +0000) 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:289420 Archived-At: > Cc: brian > From: Harald Jörg > Date: Thu, 25 Jul 2024 19:06:35 +0000 > > 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 ‘/ ... /’ 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. Thanks, since this appears to be fixed on the emacs-30 branch, I'm closing this bug.