From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: haj@posteo.de (Harald =?UTF-8?Q?J=C3=B6rg?=) Newsgroups: gmane.emacs.bugs Subject: bug#37127: [PATCH] cperl-mode: Suppress a misleading message Date: Fri, 30 Oct 2020 21:19:41 +0100 Message-ID: <87zh43cvqa.fsf@hajtower> References: <87ftlu67cy.fsf@vinc17.net> <87eelg3ffl.fsf@hajtower> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8394"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: 37127@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 30 21:20:10 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 1kYasc-0001wj-IO for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Oct 2020 21:20:10 +0100 Original-Received: from localhost ([::1]:39234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYasb-0007mB-HN for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Oct 2020 16:20:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYasU-0007lv-Nb for bug-gnu-emacs@gnu.org; Fri, 30 Oct 2020 16:20:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48307) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kYasU-0007MA-EO for bug-gnu-emacs@gnu.org; Fri, 30 Oct 2020 16:20:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kYasU-0000FQ-9C for bug-gnu-emacs@gnu.org; Fri, 30 Oct 2020 16:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: haj@posteo.de (Harald =?UTF-8?Q?J=C3=B6rg?=) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 30 Oct 2020 20:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37127 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed fixed Original-Received: via spool by 37127-submit@debbugs.gnu.org id=B37127.1604089192932 (code B ref 37127); Fri, 30 Oct 2020 20:20:02 +0000 Original-Received: (at 37127) by debbugs.gnu.org; 30 Oct 2020 20:19:52 +0000 Original-Received: from localhost ([127.0.0.1]:59853 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYasJ-0000Ex-Nf for submit@debbugs.gnu.org; Fri, 30 Oct 2020 16:19:51 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:53821) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYasH-0000Eh-I5 for 37127@debbugs.gnu.org; Fri, 30 Oct 2020 16:19:50 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 0D5A72400FD for <37127@debbugs.gnu.org>; Fri, 30 Oct 2020 21:19:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1604089183; bh=aOjU5i4RxKmFX5K7Yr92agGqCjeEYvCz1zfF2ML91Dg=; h=From:To:Cc:Subject:Date:From; b=CR5t34jIym9CYgKdIZasCiDhjyv7X3gIa56ItPTALwdI54HldNFdWA4MU2Xeg2cOI pgaOtUrxhPe01R/r5/W1cpMbB+jLe6LXzZNhGYcyWJsAy1iKIbF/2HSytaB+Fh1hYK AvRO/fCUwu3KR+wIKpzseaCTXXkiKN5vwEU6C/hNMWdXNbu7JynQjcDF97eqtZF4GU 0/z8n3rF3n3m2rx52k0G235j8bqRMNNU9HLxtL3EH/zJY2cecWc5WsfgRqe0X9N+yd PkfBmnFOtdjozrwJizPDPusekul/3vdOKw+6t7AWyIMB6FWtxkCmSP0gEisEqgHRx1 iH8FmEi1KcckA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4CNDDt1gYzz6tm5; Fri, 30 Oct 2020 21:19:42 +0100 (CET) In-Reply-To: (Stefan Monnier's message of "Fri, 30 Oct 2020 10:30:04 -0400") 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:192190 Archived-At: Stefan Monnier writes: >> +(ert-deftest cperl-bug37127 () > [...] >> + ;; part two: Regex terminator missing -> message >> + (ert-with-message-capture collected-messages >> + (with-temp-buffer >> + (insert "$_ =~ /(..;") >> + (goto-char (point-min)) >> + (cperl-mode) >> + (search-forward ".") >> + (let ((last-command-event ?\))) >> + (cperl-electric-rparen 1) >> + (cperl-find-pods-heres (point-min) (point-max) t))) >> + (should (string-match "^End of .* string/RE" >> + collected-messages))))) > > Why is this behavior desirable? > I mean, I don't necessarily mind it, but as a user I find it odd that > typing a `)` which has a matching `(` nearby (which can be found without > crossing any string/RE boundary) should emit a warning about some > "unrelated" surrounding entity like the RE in which it is located. In an unterminated RE, the message will appear for every single character you type, until the RE is terminated. I'd find it odd if the `)` was the only character where the message didn't appear :) > Emacs usually doesn't emit any such warning when editing within an > unclosed string. That's true. However, unclosed strings are rather simple constructs when compared to Perl's quote-like operators. Often, in particular with the /x modifier, they span several lines. The message contains information about which operator is currently being processed, and also what terminator is used. In Perl, almost any non-whitespace character can be used as a delimiter, including letters, quotes, comment starters, and colons. So, I think the warning is ok as a real-time syntax check. > I don't think we should necessarily change CPerl's behavior in this > regard, but that we shouldn't consider it a feature and thus shouldn't > enforce it in our tests. I see now that at least this test should be skipped in Perl mode, which I failed to do. Again. Sorry for that. In general, handling of REs with non-standard delimiters is one of the areas where Perl mode has significant deficiencies. But of course, I'm also fine with just deleting this test case. I wrote it more out of a habit to check that the fix doesn't change the behavior in other situations. -- Cheers, haj