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#16368: [PATCH] cperl-mode: don't freeze over a cool regexp Date: Thu, 3 Sep 2020 01:40:45 +0200 Message-ID: <1dce9689-f0ae-e066-bbf0-fb92f9b997ce@posteo.de> References: <87iotxq4oy.fsf@xvii.vinc17.org> 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="17088"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 To: Stefan Kangas , 16368@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 03 01:41:11 2020 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 1kDcNL-0004KJ-2G for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 03 Sep 2020 01:41:11 +0200 Original-Received: from localhost ([::1]:42676 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDcNJ-0006mr-UQ for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 02 Sep 2020 19:41:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDcNC-0006mj-Ss for bug-gnu-emacs@gnu.org; Wed, 02 Sep 2020 19:41:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49546) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kDcNB-0006T8-Vd for bug-gnu-emacs@gnu.org; Wed, 02 Sep 2020 19:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kDcNB-0003Ah-Mu for bug-gnu-emacs@gnu.org; Wed, 02 Sep 2020 19:41:01 -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: Wed, 02 Sep 2020 23:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16368 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch confirmed Original-Received: via spool by 16368-submit@debbugs.gnu.org id=B16368.159909005412169 (code B ref 16368); Wed, 02 Sep 2020 23:41:01 +0000 Original-Received: (at 16368) by debbugs.gnu.org; 2 Sep 2020 23:40:54 +0000 Original-Received: from localhost ([127.0.0.1]:32859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kDcN3-0003AD-Hu for submit@debbugs.gnu.org; Wed, 02 Sep 2020 19:40:53 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:59933) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kDcN1-0003A1-PX for 16368@debbugs.gnu.org; Wed, 02 Sep 2020 19:40:53 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 11CFA16005C for <16368@debbugs.gnu.org>; Thu, 3 Sep 2020 01:40:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1599090046; bh=mgOwSuZxai0YvELbyfhyMd0LNjpVuEi7JWt2juGgvWo=; h=Subject:To:From:Autocrypt:Date:From; b=Obaj+8WgFisPpINfoxZRI/4RCWSION8MHfbqp6HF5Fg1uGVyRrRfo6Gi/qXnafY07 vV71WaL/TN35kK3WJ2T0cVjPlM3GqFWuY4fdgFcT8c+h1cAZS0kbZB+60Vo+UuuI68 oH+mPT2U0hWzjAlNuwU6GkmBj4AXByUE6ZUsFmWdIucYkzqBQBZ/f8x6AkB5a4Xj7g K673G4pVF8Pee6WL3PXBGyuFe9ekzcrFC/H3IRCCZCBDBzZSfaEupnuSJTZP932F+A 1LzKY/C6TOIY3ezWCZdJq/WGxxS+ckwecRuh6FHd5Q5w59jEl1wiXmP+hFNvUTT/JQ ryWiMUner3Zaw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4BhgRd33Gyz6tm6; Thu, 3 Sep 2020 01:40:45 +0200 (CEST) Autocrypt: addr=haj@posteo.de; keydata= mQINBF0DVrIBEAC7TRlIilBg/5Dx7R2rV4FBDEavbyMT2cS2wWyksh7JA8e17LNmTdakf+Bm u6C2m6+frolteYRlkreoyAg0fj/5tDw/s5dJDw3tM0b+m/pj2HcwTSRpQSEy5lBiCg11E6Mt F9UngCfkGtJzu8PBWXc1RDQVBwRn5MZbpMZZatE8NOq9AA3Yg6sY11Ez3xIvYU2R7a4OSxmc RJV2+dhdQ4oOTBIGQ2urQSU81kyRtkx+/Yh8WefMrk9nF3nzYziLS53euCAXyzklwYmD6Li3 XSu7wYp5fISky9DK6DPFK7h4RXEL4GFAhy31ehrVnNTcGRohM1Dm9BV9dwXkwlaeT3q0X+nE SXVqPDHtv748bXNIg2WVCZ0WgShcA46XVlSE9Fm+w0HI/1m1L4BaMmQ7gyK5dEchbhxohkk0 AqC3hEJ4ULRidrsCoCWGMFKiOIb9rjeC00vhrUkVJDkPWEGLXjhnRQykb6cESko0rPrSDLqX 9YqaNQ6KO9Un6uogE7YnXYg35EXJ8ORdX257IbXNbFVpgM8FFsl48WV3Pl9WNdADhnnOrz3O wzyK58i/BTsnjVX8ghbWkQcPQ2Kprt+4YR2trEi7TM5Uqzzrg0vp7Oe/9KZBxdxCE67thV7h ElW3CHb4q6o31b4cFmLbtFesSy+hnUU4UymgHgi/hvhxioBxIQARAQABtBxIYXJhbGQgSsO2 cmcgPGhhakBwb3N0ZW8uZGU+iQJOBBMBCAA4FiEEIpYEZLQynxF8Q17KN4XzzzqAcpsFAl0D VrICGwMFCwkIBwIGFQgJCgsCBBYCAwECHgECF4AACgkQN In-Reply-To: Content-Language: en-US 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" Xref: news.gmane.io gmane.emacs.bugs:186972 Archived-At: On 9/3/20 12:19 AM, Stefan Kangas wrote: > Harald Jörg 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? Yes, it is, sort of. Maybe it should be fine-tuned. At this point we _have_ the situation of unbalanced parentheses, and cperl-mode rubs it in for every character you type. Just open a buffer in cperl-mode and start typing: $a =~ s/ At this point a message appears, with a different text when you open a parentheses, and will haunt you until you get everything closed properly. Given that regexps can be messy and heavy with punctuation, I'd say this is desired behavior. I can only guess that the first part of the message (which starts with "cperl-forward-group-in-re") was added out of frustration: The bug prevented the second part of the message (without "cperl-forward-group-in-re") from ever appearing. Only this wasn't fatal unless... there was this closing brace two characters before. I'll check that, and prepare an updated patch if that's true. > --- > > Also, some minor nits: > >> Subject: [PATCH] =?UTF-8?q?2020-09-02=20=20Harald=20J=C3=B6rg=20=20> =?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). No problem, I'll do so. I thought I was supposed to create the commit messages with C-x 4 a, but probably I misunderstood and should have post-processed that text in the first place. >> --- 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) Hm. That should rather be _moving_ that line to the top? The line is there, in the test which calls this function. For me this seemed to be enough to avoid that message when byte-compiling. But of course, moving the line to the top is fine, probably more tests will follow to exercise functions which aren't autoloaded. Give me a few hours for a nap: It's past midnight here :) -- Cheers, haj