From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 21 08:17:16 2019 Received: (at submit) by debbugs.gnu.org; 21 Aug 2019 12:17:16 +0000 Received: from localhost ([127.0.0.1]:34832 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i0PYC-0005Js-BW for submit@debbugs.gnu.org; Wed, 21 Aug 2019 08:17:16 -0400 Received: from lists.gnu.org ([209.51.188.17]:50469) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i0PYB-0005Jl-5S for submit@debbugs.gnu.org; Wed, 21 Aug 2019 08:17:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34708) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0PY9-0004Me-Ga for bug-gnu-emacs@gnu.org; Wed, 21 Aug 2019 08:17:14 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_NONE, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0PY7-0004Ic-V7 for bug-gnu-emacs@gnu.org; Wed, 21 Aug 2019 08:17:13 -0400 Received: from cventin.lip.ens-lyon.fr ([140.77.13.17]:46894) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i0PY7-0004De-Ne for bug-gnu-emacs@gnu.org; Wed, 21 Aug 2019 08:17:11 -0400 Received: from vlefevre by cventin.lip.ens-lyon.fr with local (Exim 4.92.1) (envelope-from ) id 1i0PXx-00023c-CD; Wed, 21 Aug 2019 14:17:01 +0200 From: Vincent Lefevre To: bug-gnu-emacs@gnu.org Subject: 27.0.50; in cperl mode, scan-error Unbalanced parentheses Date: Wed, 21 Aug 2019 14:17:01 +0200 Message-ID: <87ftlu67cy.fsf@vinc17.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 140.77.13.17 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On the following file # -*- mode: cperl -*- s/./(/e; putting the cursor just after the opening parenthesis then typing a closing parenthesis yields the following error: End of =E2=80=98s/ ... // ... /=E2=80=99 string/RE not found: (scan-error= Unbalanced parentheses 26 29) This follows https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D33114#21 In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.10) of 2019-08-20 built on cventin Repository revision: 50dc4ca8d02a466a7236765edf83ae7cfb02d74c Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12004000 System Description: Debian GNU/Linux bullseye/sid Recent messages: Loading /home/vlefevre/share/emacs/site-lisp/mutteditor.el (source)...done Loading time...done For information about GNU Emacs and the GNU system, type C-h C-a. Configured using: 'configure --prefix=3D/usr/local/emacs-trunk' Configured features: XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS LIBSYSTEMD PDUMPER LCMS2 GMP Important settings: value of $LC_COLLATE: POSIX value of $LC_CTYPE: en_US.UTF-8 value of $LC_TIME: en_DK value of $LANG: POSIX locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: display-time-mode: t show-paren-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr warnings emacsbug message rmc puny dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs text-property-search time-date subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils time cus-start cus-load paren cc-styles cc-align cc-engine cc-vars cc-defs edmacro kmacro cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 65536 8229) (symbols 48 8743 1) (strings 32 20748 2347) (string-bytes 1 700746) (vectors 16 11323) (vector-slots 8 144376 12556) (floats 8 24 26) (intervals 56 219 10) (buffers 992 12)) From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 03 19:02:33 2019 Received: (at 37127) by debbugs.gnu.org; 3 Oct 2019 23:02:33 +0000 Received: from localhost ([127.0.0.1]:41431 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iGA7F-00044G-7E for submit@debbugs.gnu.org; Thu, 03 Oct 2019 19:02:33 -0400 Received: from mail-pg1-f177.google.com ([209.85.215.177]:46356) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iGA7D-00043x-Uo for 37127@debbugs.gnu.org; Thu, 03 Oct 2019 19:02:32 -0400 Received: by mail-pg1-f177.google.com with SMTP id a3so2591958pgm.13 for <37127@debbugs.gnu.org>; Thu, 03 Oct 2019 16:02:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=8WQAeDHoI1CTwfQKAuY6+WmGZiipUADBSps3+dDzumg=; b=lCFeiNscvUh9nkVIIOZ/EEims4MpE/3n1OFGs2NlMlox+7wC6FlOmwzP2qHDMbzAXB C8IRNusVyVceIsl6bBInxw/zCWWpsrK36nM9YvN6+wh3Le6VsSgbdbdFfZntjxq+4q4p WI0yRt55Bz8J0IZuRWgtnfKlqVmyDLbnTYZHKnok1w5BsYnKNWj4staTe3sRFMpFSNju eZvb7weMTUCQKNYoDpzjqgmLewKEXJg/rE45KwGAZAoiykaw12U4mbqSL+4FT/7UN2k3 ep1/w2ZtRfvax4zu+QPsQTNyjPnFh16XkrUhtyj8goM64eRy4GHgqSv7cxEIHIVgBzMZ V82A== X-Gm-Message-State: APjAAAX5f+tOqXTHfFrsmhniCeiP/8DVBhgg7ESHj+jw6NCUofsBTSJM 73TflEZpdE7NIGyPeXQ84rcYPifEpCTQO46tPWbpq4gX X-Google-Smtp-Source: APXvYqz13zDXj73w1FX0zao3ae3Ju8e8whmpXRyV0mu4EioWSjYbS1xhVRzYccsy2W1zrFGKzlghFY4UJZy8Fv6EeWk= X-Received: by 2002:a63:720f:: with SMTP id n15mr11683530pgc.198.1570143746049; Thu, 03 Oct 2019 16:02:26 -0700 (PDT) MIME-Version: 1.0 References: <87ftlu67cy.fsf@vinc17.net> In-Reply-To: <87ftlu67cy.fsf@vinc17.net> From: Stefan Kangas Date: Fri, 4 Oct 2019 01:02:14 +0200 Message-ID: Subject: Re: bug#37127: 27.0.50; in cperl mode, scan-error Unbalanced parentheses To: Vincent Lefevre Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 37127 Cc: 37127@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) tags 37127 + confirmed quit Vincent Lefevre writes: > On the following file > > # -*- mode: cperl -*- > s/./(/e; > > putting the cursor just after the opening parenthesis then typing a > closing parenthesis yields the following error: > > End of =E2=80=98s/ ... // ... /=E2=80=99 string/RE not found: (scan-err= or Unbalanced parentheses 26 29) I can reproduce this as well. Best regards, Stefan Kangas From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 29 17:12:08 2020 Received: (at 37127) by debbugs.gnu.org; 29 Oct 2020 21:12:08 +0000 Received: from localhost ([127.0.0.1]:55104 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYFDM-0001Vk-CS for submit@debbugs.gnu.org; Thu, 29 Oct 2020 17:12:08 -0400 Received: from mout02.posteo.de ([185.67.36.66]:46301) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYFDJ-0001VG-QJ for 37127@debbugs.gnu.org; Thu, 29 Oct 2020 17:12:06 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id ECC202400FD for <37127@debbugs.gnu.org>; Thu, 29 Oct 2020 22:11:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1604005920; bh=3cLnFd5hVbXDc9zewVLLUbrnN4mzfCArSR+yhtF64Lc=; h=From:To:Subject:Date:From; b=TuMhbHrzLgMOHEwaEUil8Fx+S5JPadh/tEXDnyNWbiDGZcK61Cfm+VaSfdHE8fAxg vpgJm80khU7i1t0+Uat5Drg0hzl1RFGFOqGfN30MJX4wADTV2txlNqCcv+cIxYXtPR L2CQLikW/RiDVd8/IQrdb1nwWY7hovcPm7O9/dwi5VDtC1EzYCBzl/nA1BLP3S3coi 2NpTQJGEuzxqPo7fP7Fn+C/RXQ3bBTVURtfo7/qdzvDVr8eSxS0ECsvlrkFWcTyRn1 aiI1VQCHnixtymbpMdlTRIHtdEDMO/vcd0lpaDEV6KqSY7JFVy1dxzkx05gJlSFgGA JyXuiepwv/Vgg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4CMdRg2nBZz9rxS for <37127@debbugs.gnu.org>; Thu, 29 Oct 2020 22:11:59 +0100 (CET) From: haj@posteo.de (Harald =?utf-8?Q?J=C3=B6rg?=) To: 37127@debbugs.gnu.org Subject: [PATCH] cperl-mode: Suppress a misleading message User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Date: Thu, 29 Oct 2020 22:11:58 +0100 Message-ID: <87eelg3ffl.fsf@hajtower> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37127 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain The unjustified message about a missing end of a RE is rather harmless, it goes away after the next keystroke. Nevertheless, this can be fixed. It also happens in several related situations. The message has its cause in the apparently totally unrelated function 'blink-matching-open'. Whenever a closing paren is inserted, this function highlights the corresponding opening paren for a short time. As part of its processing, it narrows the buffer so that it ends with the closing paren - thereby excluding the end of the regular expression. In this state, it calls 'syntax-propertize', which in turn runs through the cperl-mode functions for syntaxification, ending up eventually in 'cperl-forward-re' - which fails to find the end of the regular expression in the narrowed buffer. The patch suppresses the message if the following conditions are met: 1) The buffer is currently narrowed 2) We are at the end of the (narrowed) buffer 3) The error in question is of type 'scan-error The patch also contains a test to verify that the message isn't written in the situation given in the bug report, and also that the message is written if we do indeed have an unterminated regular expression. -- Cheers, haj --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Suppress-a-misleading-message-when-closing-a-paren-i.patch Content-Description: Suppress a misleading message >From 85b8ccab3d5e43a4a3d4e622529248973b606a04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20J=C3=B6rg?= Date: Thu, 29 Oct 2020 21:03:12 +0100 Subject: [PATCH] ; Suppress a misleading message when closing a paren in a regex * lisp/progmodes/cperl-mode.el (cperl-forward-re): Suppress an error message about "End of string/RE not found" when we are at the end of a narrowed buffer where the end of a RE is temporarily unavailable (Bug#37127). * test/lisp/progmodes/cperl-mode-tests.el (cperl-bug37127): Add a test to verify that the message is suppressed when inappropriate, but appears when the RE *is* incomplete. --- lisp/progmodes/cperl-mode.el | 7 ++++++ test/lisp/progmodes/cperl-mode-tests.el | 29 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index ebbea6bed9..94f42cb2bc 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -3225,6 +3225,13 @@ cperl-forward-re (and cperl-brace-recursing (or (eq ostart ?\{) (eq starter ?\{))) + ;; If we are at the end of a narrowed buffer, then a + ;; scan error should not be reported to the user. + ;; This situation actually happens when a closing + ;; paren is entered in a regular expression. + ;; Reported in Bug#37127. + (and (eobp) (buffer-narrowed-p) + (equal (car bb) 'scan-error)) (message "End of `%s%s%c ... %c' string/RE not found: %s" argument diff --git a/test/lisp/progmodes/cperl-mode-tests.el b/test/lisp/progmodes/cperl-mode-tests.el index e67678cf6b..4b949bc9a7 100644 --- a/test/lisp/progmodes/cperl-mode-tests.el +++ b/test/lisp/progmodes/cperl-mode-tests.el @@ -218,4 +218,33 @@ cperl-mode-fontify-punct-vars (should (equal (nth 3 (syntax-ppss)) nil)) (should (equal (nth 4 (syntax-ppss)) t)))))) +(ert-deftest cperl-bug37127 () + "Verify that closing a paren in a regex goes without a message. +Also check that the message is issued if the regex terminator is +missing." + (let (collected-messages) + ;; Part one: Regex is ok, no messages + (ert-with-message-capture collected-messages + (with-temp-buffer + (insert "$_ =~ /(./;") + (cperl-mode) + (goto-char (point-min)) + (search-forward ".") + (let ((last-command-event ?\))) + (cperl-electric-rparen 1) + (cperl-find-pods-heres (point-min) (point-max) t))) + (should (string-equal collected-messages ""))) + ;; 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))))) + ;;; cperl-mode-tests.el ends here -- 2.20.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 30 08:24:41 2020 Received: (at 37127) by debbugs.gnu.org; 30 Oct 2020 12:24:41 +0000 Received: from localhost ([127.0.0.1]:56507 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYTST-00068x-1i for submit@debbugs.gnu.org; Fri, 30 Oct 2020 08:24:41 -0400 Received: from quimby.gnus.org ([95.216.78.240]:36922) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYTSR-00068h-IJ for 37127@debbugs.gnu.org; Fri, 30 Oct 2020 08:24:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=B1jUpXJHk6v1F0Tg5HiDMPhbaemqKo4m9ozI5g7ufQk=; b=pPMsxm2NzlDWyG+MbXQyeOMz7q x0xWT3eGyjnS4vHj8z/Bq+HlczK/Sw4EDZVS6/gX9bdi9HYq133ZqMKzIKZPXDARVWBO+Ey3nTHF+ /z7tyH9S6sgLCledsCcYLZAg3gYZGATZUYcpdkETiK2Z0xUov0gv//kZiImk7nSmaRtA=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kYTSF-0008Nn-Q1; Fri, 30 Oct 2020 13:24:33 +0100 From: Lars Ingebrigtsen To: haj@posteo.de (Harald =?utf-8?Q?J=C3=B6rg?=) Subject: Re: bug#37127: [PATCH] cperl-mode: Suppress a misleading message References: <87ftlu67cy.fsf@vinc17.net> <87eelg3ffl.fsf@hajtower> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAG1BMVEX7+/vSz8+mo6Zb WF0fGhovKixBPEB/e4H///+DCN/PAAAAAWJLR0QIht6VegAAAAd0SU1FB+QKHgwOIWCHD40AAAGk SURBVDjLtZTPjtsgEMZBfQGDD73GE0U5r6eLH6CwPW8NPMAiptfGrpTX74CdOEqzp6ifLP/hx3wz gsFCPJBiiSfUCCHL7V5SKQ1aPSIcJBvxP/TFhRAph1UJEft5ODYMrAveXuR4zkgjVsATecQumIpB BXYBdo3iD5dX4AJdrSrYItCz1dvED54VwgW4NHgu4F3IQ424AWfvvP8tVMsg3wAc+HOETjKIecvh MDt6/YE/W1qASQuImIy17/uXQ6ggrMBFPLUJT1Lt0drEAC+g10Oz74QCzpHoCmw86Z1oX4SeWq7Q XK1s7LtO4odScHAjmpvkQ8f7nfSA30a8B+LwXanZ/kKkDYw4qa8IoP5EpLJntAGYJw2AxWhZq10B b3gGrSdQiIBlkyma3bIkWLKDgjPMBeQLSJxEMzqyly9eG+iBdS45GPCVF0Cmn+A48zDl0hNXEA0m rmlGrtXdgVh8MPsCSpYKbDQUyripIGwgENXexGzXTvULcDmGEYlT8LsvnVJALRspGV6/17BFPJJ8 7jR/KtU1bN39a84nXD75D2k+Gf8LJHu4UBQcHYUAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjAtMTAt MzBUMTI6MTQ6MzMrMDA6MDCwMDDJAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIwLTEwLTMwVDEyOjE0 OjMzKzAwOjAwwW2IdQAAAABJRU5ErkJggg== X-Now-Playing: PJ Harvey's _Dry Demos_: "Victory" Date: Fri, 30 Oct 2020 13:24:26 +0100 In-Reply-To: <87eelg3ffl.fsf@hajtower> ("Harald =?utf-8?Q?J=C3=B6rg=22's?= message of "Thu, 29 Oct 2020 22:11:58 +0100") Message-ID: <87eelfkikl.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: haj@posteo.de (Harald Jörg) writes: > The patch suppresses the message if the following conditions are met: > 1) The buffer is currently narrowed > 2) We are at the end of the (narrowed) buffer > 3) The error in question is of type 'sca [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37127 Cc: 37127@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) haj@posteo.de (Harald J=C3=B6rg) writes: > The patch suppresses the message if the following conditions are met: > 1) The buffer is currently narrowed > 2) We are at the end of the (narrowed) buffer > 3) The error in question is of type 'scan-error Makes sense to me, so I've pushed the change to Emacs 28. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 30 08:24:50 2020 Received: (at control) by debbugs.gnu.org; 30 Oct 2020 12:24:50 +0000 Received: from localhost ([127.0.0.1]:56510 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYTSc-00069L-BU for submit@debbugs.gnu.org; Fri, 30 Oct 2020 08:24:50 -0400 Received: from quimby.gnus.org ([95.216.78.240]:36936) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYTSb-000697-9X for control@debbugs.gnu.org; Fri, 30 Oct 2020 08:24:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=TehwZdCqwhlhcTys1iKjYQa6+o4nIe5Vx0hVXDZ06qY=; b=JDdpbiFpoXRXzeFw6ZVZBMnqvJ E/rld4p5xxj3gUlIg/wImXGNHB0Vq0zrLiFW/xd/ciXhILr1mfs/32T+kpJsNTRmRcw04AQo7N3VX iCO69HxsBXnTfD2jfcFtZpYZoBZWSe4ZNXjJvxth2KTYKLV55xGFLkhcetdreB39TPFA=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kYTST-0008Nv-HK for control@debbugs.gnu.org; Fri, 30 Oct 2020 13:24:43 +0100 Date: Fri, 30 Oct 2020 13:24:40 +0100 Message-Id: <87d00zkik7.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #37127 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 37127 fixed close 37127 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 37127 fixed close 37127 28.1 quit From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 30 10:30:26 2020 Received: (at 37127) by debbugs.gnu.org; 30 Oct 2020 14:30:26 +0000 Received: from localhost ([127.0.0.1]:59177 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYVQA-00026q-64 for submit@debbugs.gnu.org; Fri, 30 Oct 2020 10:30:26 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:33679) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYVQ4-0001v1-Uk for 37127@debbugs.gnu.org; Fri, 30 Oct 2020 10:30:21 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 1A2BF80BCE; Fri, 30 Oct 2020 10:30:15 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id C4FC9809A7; Fri, 30 Oct 2020 10:30:13 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1604068213; bh=xKEdAJU6WI1pjdOtzlsZ6AfbXrzwLP6gHNTmizhcZzg=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=YwouP8Ijnao1jwLwQiwP+nr1eqRpSftRocuRBGpJBetl6r16OIxD7/19iyxFFXeXl SrUgmhto4Z+Z7dw5XmEvLWsxdJW5Y31itDp+ij7INpLBDcMN/VU7HFV3vNzltONnz5 2USfFwFzt2IAJVxkk2qOAceDx8hbQBx24WNjKIALVePNuIp7BIXjiDm8nmQQXpmVR4 HnmRWixlTHKKl1YHibQwAlYcIoZcNjU1UEuyBI8xjotJQUW3zdzIOmwn9tSiVtgJee KFh9oLnxVX+O9bwWLjGnr/M+yOepYgPgBkj/bDi/wPnNqJBAeiKTNsSUCryWvUyAMK jnUQ1ODVy6AKg== Received: from alfajor (unknown [157.52.9.240]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3BD24120205; Fri, 30 Oct 2020 10:30:13 -0400 (EDT) From: Stefan Monnier To: haj@posteo.de (Harald =?windows-1252?Q?J=F6rg?=) Subject: Re: bug#37127: [PATCH] cperl-mode: Suppress a misleading message Message-ID: References: <87ftlu67cy.fsf@vinc17.net> <87eelg3ffl.fsf@hajtower> Date: Fri, 30 Oct 2020 10:30:04 -0400 In-Reply-To: <87eelg3ffl.fsf@hajtower> ("Harald =?windows-1252?Q?J=F6rg=22?= =?windows-1252?Q?'s?= message of "Thu, 29 Oct 2020 22:11:58 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.059 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37127 Cc: 37127@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > +(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. Emacs usually doesn't emit any such warning when editing within an unclosed string. 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. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 30 16:19:52 2020 Received: (at 37127) by debbugs.gnu.org; 30 Oct 2020 20:19:52 +0000 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 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 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== 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) From: haj@posteo.de (Harald =?utf-8?Q?J=C3=B6rg?=) To: Stefan Monnier Subject: Re: bug#37127: [PATCH] cperl-mode: Suppress a misleading message In-Reply-To: (Stefan Monnier's message of "Fri, 30 Oct 2020 10:30:04 -0400") References: <87ftlu67cy.fsf@vinc17.net> <87eelg3ffl.fsf@hajtower> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Date: Fri, 30 Oct 2020 21:19:41 +0100 Message-ID: <87zh43cvqa.fsf@hajtower> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37127 Cc: 37127@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) 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 From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 30 18:12:24 2020 Received: (at 37127) by debbugs.gnu.org; 30 Oct 2020 22:12:24 +0000 Received: from localhost ([127.0.0.1]:60051 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYcdD-00038W-Pv for submit@debbugs.gnu.org; Fri, 30 Oct 2020 18:12:24 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:64874) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYcdC-00038F-8l for 37127@debbugs.gnu.org; Fri, 30 Oct 2020 18:12:22 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id C8DF21002FA; Fri, 30 Oct 2020 18:12:16 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 045F610025D; Fri, 30 Oct 2020 18:12:15 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1604095935; bh=76p442ZfTQKaaIcY8tJGUGAuqBm9BgTqIDzUk9d/EMY=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=ELDDerZC5/04Ia7Orax5XfHdFhzBaGSyykjqZ2wIgXfaiHbM+2RKjp7UP7F3mHUIH CAxIDUlAOlQv8PqNMaCzygU6N1i4jtler2bbDmY47zae3S3NzRtWvGX18RdpYUlM/Z xlV+SSgw/aKMWZWlWh3odrWkGJqxvCypu5ytW6bSEWJdhXkNrpT2Yf9C4lhjfUh0ge zHtVn5ixLnPBJUEIvgM9uv3TLFSWLT9qiX82TMsxvVEXRTPbLap4Mnbt7TFW57mS/u irkAJcqlTtk0vBb3yVD0AHKvCq51YQ4jXKp1PfyGRp7f8I/oets+JO/LHQ+v+iCED4 DunUxiA9xhvtA== Received: from alfajor (unknown [157.52.9.240]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C8A9E120380; Fri, 30 Oct 2020 18:12:14 -0400 (EDT) From: Stefan Monnier To: haj@posteo.de (Harald =?windows-1252?Q?J=F6rg?=) Subject: Re: bug#37127: [PATCH] cperl-mode: Suppress a misleading message Message-ID: References: <87ftlu67cy.fsf@vinc17.net> <87eelg3ffl.fsf@hajtower> <87zh43cvqa.fsf@hajtower> Date: Fri, 30 Oct 2020 18:12:13 -0400 In-Reply-To: <87zh43cvqa.fsf@hajtower> ("Harald =?windows-1252?Q?J=F6rg=22?= =?windows-1252?Q?'s?= message of "Fri, 30 Oct 2020 21:19:41 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.068 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37127 Cc: 37127@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> 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 :) I agree that `)` should be no different. And while as a user I find such messages more annoying than helpful (I much prefer to be warned by some font-lock highlighting (e.g. by "bleeding" past what I expected to be the end) or something like a tooltip), I'm OK with the current behavior. I just don't think that not emitting the message should trigger a test failure. > In Perl, almost any non-whitespace character can be used as > a delimiter, including letters, quotes, comment starters, and colons. Yes, I remember that from when I wrote the corresponding syntax-propertize code for `perl-mode` ;-) > I see now that at least this test should be skipped in Perl mode, which > I failed to do. Again. Sorry for that. No problem. BTW, I just noticed that if I revert your patch to cperl-mode.el, the test still succeeds :-( > In general, handling of REs with non-standard delimiters is one of the > areas where Perl mode has significant deficiencies. Hmm... I thought I had managed to make it cover most cases back then. I'd be interested to know which cases I missed (or which new cases were introduced since then: after all it was quite some years ago). In any case, along the way I decided that this bug was in large part to blame on blink-matching-open because it calls `syntax-propertize` from within narrowing. So I changed it which made your `cperl-mode` patch unnecessary. I also tweaked your test so that it does fail in the old code (and passes with the new code) and so it also works in `perl-mode` (except for the second part which I kept but which would fail in `perl-mode`). The patch I installed can be found below. Stefan diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 94f42cb2bc..ebbea6bed9 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -3225,13 +3225,6 @@ cperl-forward-re (and cperl-brace-recursing (or (eq ostart ?\{) (eq starter ?\{))) - ;; If we are at the end of a narrowed buffer, then a - ;; scan error should not be reported to the user. - ;; This situation actually happens when a closing - ;; paren is entered in a regular expression. - ;; Reported in Bug#37127. - (and (eobp) (buffer-narrowed-p) - (equal (car bb) 'scan-error)) (message "End of `%s%s%c ... %c' string/RE not found: %s" argument diff --git a/lisp/simple.el b/lisp/simple.el index 2e40e3261c..b1b9c88b32 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -8014,6 +8014,7 @@ blink-matching-open (blinkpos (save-excursion (save-restriction + (syntax-propertize (point)) (if blink-matching-paren-distance (narrow-to-region (max (minibuffer-prompt-end) ;(point-min) unless minibuf. @@ -8024,7 +8025,7 @@ blink-matching-open (not blink-matching-paren-dont-ignore-comments)))) (condition-case () (progn - (syntax-propertize (point)) + ;; (syntax-propertize (point)) ;?? (forward-sexp -1) ;; backward-sexp skips backward over prefix chars, ;; so move back to the matching paren. diff --git a/test/lisp/progmodes/cperl-mode-tests.el b/test/lisp/progmodes/cperl-mode-tests.el index 75010f7d0f..33ebcccde8 100644 --- a/test/lisp/progmodes/cperl-mode-tests.el +++ b/test/lisp/progmodes/cperl-mode-tests.el @@ -224,28 +224,33 @@ cperl-bug37127 "Verify that closing a paren in a regex goes without a message. Also check that the message is issued if the regex terminator is missing." - (let (collected-messages) - ;; Part one: Regex is ok, no messages - (ert-with-message-capture collected-messages - (with-temp-buffer - (insert "$_ =~ /(./;") - (cperl-mode) - (goto-char (point-min)) - (search-forward ".") - (let ((last-command-event ?\))) - (cperl-electric-rparen 1) - (cperl-find-pods-heres (point-min) (point-max) t))) - (should (string-equal collected-messages ""))) - ;; part two: Regex terminator missing -> message + ;; Part one: Regex is ok, no messages + (ert-with-message-capture collected-messages + (with-temp-buffer + (insert "$_ =~ /(./;") + (funcall cperl-test-mode) + (goto-char (point-min)) + (search-forward ".") + (let ((last-command-event ?\)) + ;; Don't emit "Matches ..." even if not visible (e.g. in batch). + (blink-matching-paren 'jump-offscreen)) + (self-insert-command 1) + (blink-matching-open)) + (syntax-propertize (point-max))) + (should (string-equal collected-messages ""))) + ;; part two: Regex terminator missing -> message + (when (eq cperl-test-mode #'cperl-mode) + ;; This test is only run in `cperl-mode' because only cperl-mode + ;; emits a message to warn about such unclosed REs. (ert-with-message-capture collected-messages (with-temp-buffer (insert "$_ =~ /(..;") (goto-char (point-min)) - (cperl-mode) + (funcall cperl-test-mode) (search-forward ".") (let ((last-command-event ?\))) - (cperl-electric-rparen 1) - (cperl-find-pods-heres (point-min) (point-max) t))) + (self-insert-command 1)) + (syntax-propertize (point-max))) (should (string-match "^End of .* string/RE" collected-messages))))) From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 30 21:09:56 2020 Received: (at 37127) by debbugs.gnu.org; 31 Oct 2020 01:09:56 +0000 Received: from localhost ([127.0.0.1]:60210 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYfP2-0007UP-0Q for submit@debbugs.gnu.org; Fri, 30 Oct 2020 21:09:56 -0400 Received: from mout02.posteo.de ([185.67.36.66]:53733) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYfOz-0007UA-Lb for 37127@debbugs.gnu.org; Fri, 30 Oct 2020 21:09:54 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 51DAB2400FB for <37127@debbugs.gnu.org>; Sat, 31 Oct 2020 02:09:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1604106587; bh=pDp3jFDqkV4t2vlXXayCv3UfJ8NExa4yPleSjCllX2o=; h=From:To:Cc:Subject:Date:From; b=iYqDKDvQ6IS7qlX/wTjCqtq2+VWHfwM78C+rP200lBo7emMl+3otWIaCWTaKfwVrY PUafYOfvJxBGdZlZV76TTJ7vyWRX0mUUk95yqN3OMTCwJ1htCMPLj6IewgmQduQs08 Y206y76TKdM+ZnggRJveXzy3Y9vLRrqHfU7lTkDRDcVMqEKuFIGFe7dTe1YrcbAxIv UUx4Du05zLy1VpFJBPZWZesUTYoSsHSmLK5lhC2n0Sja5Nq1Mvfkik+U9rM8tQNqrM vR9EQ7JIu+GoL3bIlmzlj6msyA3YzuwO1UO5xyhFaJn1BVq0uV3kcI0Jgfd+JOXdY8 nwbakB9Xgbh6A== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4CNLgZ30T4z9rxN; Sat, 31 Oct 2020 02:09:46 +0100 (CET) From: haj@posteo.de (Harald =?utf-8?Q?J=C3=B6rg?=) To: Stefan Monnier Subject: Re: bug#37127: [PATCH] cperl-mode: Suppress a misleading message In-Reply-To: (Stefan Monnier's message of "Fri, 30 Oct 2020 18:12:13 -0400") References: <87ftlu67cy.fsf@vinc17.net> <87eelg3ffl.fsf@hajtower> <87zh43cvqa.fsf@hajtower> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Date: Sat, 31 Oct 2020 02:09:45 +0100 Message-ID: <87tuubciau.fsf@hajtower> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37127 Cc: 37127@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Stefan Monnier writes: >> 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 :) > > I agree that `)` should be no different. And while as a user I find > such messages more annoying than helpful (I much prefer to be warned by > some font-lock highlighting (e.g. by "bleeding" past what I expected to > be the end) or something like a tooltip), I'm OK with the current > behavior. I just don't think that not emitting the message should > trigger a test failure. I agree. Also, I would be fine with different warning mechanisms, but I guess these need more work (and are not in the scope for the current bug). >> In Perl, almost any non-whitespace character can be used as >> a delimiter, including letters, quotes, comment starters, and colons. > > Yes, I remember that from when I wrote the corresponding > syntax-propertize code for `perl-mode` ;-) > >> I see now that at least this test should be skipped in Perl mode, which >> I failed to do. Again. Sorry for that. > > No problem. > > BTW, I just noticed that if I revert your patch to cperl-mode.el, the > test still succeeds :-( Maybe I should look into that.... When run manually, the symptom is there, in various Emacs versions, and goes away with the patch. Without the patch, the test fails when I run ERT interactively with emacs -Q in Emacs 26.1. It succeeds without the patch when I run ERT in batch :( I know I had several attempts to trick ERT into simulating a closing paren keyboard event, but apparently still failed. I suspect the tests don't make it past The caller of blink-matching-open (blink-paren-post-self-insert-function), which tests for interactive use. Your version calls blink-matching-open directly and avoids that problem. >> In general, handling of REs with non-standard delimiters is one of the >> areas where Perl mode has significant deficiencies. > Hmm... I thought I had managed to make it cover most cases back then. > I'd be interested to know which cases I missed (or which new cases were > introduced since then: after all it was quite some years ago). I'll send that off-list (it has nothing to do with the current bug). > In any case, along the way I decided that this bug was in large part to > blame on blink-matching-open because it calls `syntax-propertize` from > within narrowing. So I changed it which made your `cperl-mode` > patch unnecessary. I also tweaked your test so that it does fail in the > old code (and passes with the new code) and so it also works in > `perl-mode` (except for the second part which I kept but which would > fail in `perl-mode`). This is excellent! I didn't dare to even think about changing this function which apparently works for all other modes, so I tried to work around the issue. > The patch I installed can be found below. Great! Much better now. Many thanks! -- Cheers, haj From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 02 17:53:07 2020 Received: (at 37127) by debbugs.gnu.org; 2 Nov 2020 22:53:07 +0000 Received: from localhost ([127.0.0.1]:42888 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZihG-0007rW-U6 for submit@debbugs.gnu.org; Mon, 02 Nov 2020 17:53:07 -0500 Received: from mout01.posteo.de ([185.67.36.65]:55302) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZihE-0007r2-Rm for 37127@debbugs.gnu.org; Mon, 02 Nov 2020 17:53:05 -0500 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id E5E40160060 for <37127@debbugs.gnu.org>; Mon, 2 Nov 2020 23:52:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1604357577; bh=sMl+rYZkUZZqXOI7sCXWJDnpQoSHugyejfCvqIFcTMY=; h=From:To:Subject:Date:From; b=CRnNl+Xe8F0+UzSPf8Won/u+4KXyQHznKF5f9C23VZrzmAXzcGMKw4rEpDf9pI0NK vv6SuLmv80EyOumsqVZnlHvONztCtFV1oidu/n8bUyENjPVkJAqFIM1wVN5DhXVpEb aqzBwx04kxIHxk6bFSU8L+LLHBrJJxGoQRD04vPXuwOhe/Tu/PP/fn79scfZ56vFHt LSlELveh/hw55D/8UEXJNBj8X9jgB3hrKKfENmo8CoJFzJ6GbNPIsEqAvXXPSUXURh le+4KJSrgCVnYLL9q8c5wdVuA4iEM2bYdA9bvXgAt4nAj4qyKB7LWQGVOp3k54JMqw e+WrQdx1aD1Hg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4CQ7VK2cB7z9rxD for <37127@debbugs.gnu.org>; Mon, 2 Nov 2020 23:52:57 +0100 (CET) From: haj@posteo.de (Harald =?utf-8?Q?J=C3=B6rg?=) To: 37127@debbugs.gnu.org Subject: [PATCH] A final tweak: Skip the test for older Emacsen User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Date: Mon, 02 Nov 2020 23:52:56 +0100 Message-ID: <871rhbl6bb.fsf@hajtower> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37127 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain The current fix for this bug is in simple.el. This comes with the side effect that it will not be available in older Emacs versions when CPerl mode makes its way to GNU ELPA. The bug is completely harmless, I guess that porting the fix to older versions isn't worth the effort. I suggest to just skip the test when run under Emacs < 28, though this isn't strictly mandatory in the Emacs repository. -- Cheers, haj --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-cperl-mode-Skip-a-test-for-older-Emacsen-preparing-f.patch Content-Description: Skip a test for older Emacsen >From 365163de04a42ea9a24a56a8d68781988def8f42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20J=C3=B6rg?= Date: Mon, 2 Nov 2020 23:44:58 +0100 Subject: [PATCH] cperl-mode: Skip a test for older Emacsen (preparing for ELPA) * test/lisp/progmodes/cperl-mode-tests.el (cperl-bug37127): Skip this test for older Emacsen. The bug has been fixed in Emacs, but outside of CPerl mode, and therefore will not be available for older versions via ELPA. --- test/lisp/progmodes/cperl-mode-tests.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/lisp/progmodes/cperl-mode-tests.el b/test/lisp/progmodes/cperl-mode-tests.el index 9a7b5e4d6d..dcde3b68a0 100644 --- a/test/lisp/progmodes/cperl-mode-tests.el +++ b/test/lisp/progmodes/cperl-mode-tests.el @@ -224,6 +224,10 @@ cperl-bug37127 "Verify that closing a paren in a regex goes without a message. Also check that the message is issued if the regex terminator is missing." + ;; The actual fix for this bug is in simple.el, which is not + ;; backported to older versions of Emacs. Therefore we skip this + ;; test if we're running Emacs 27 or older. + (skip-unless (< 27 emacs-major-version)) ;; Part one: Regex is ok, no messages (ert-with-message-capture collected-messages (with-temp-buffer -- 2.20.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 02 18:14:06 2020 Received: (at 37127) by debbugs.gnu.org; 2 Nov 2020 23:14:06 +0000 Received: from localhost ([127.0.0.1]:42923 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZj1a-0008O2-IW for submit@debbugs.gnu.org; Mon, 02 Nov 2020 18:14:06 -0500 Received: from mail-ej1-f49.google.com ([209.85.218.49]:34420) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZj1Z-0008NR-Aa for 37127@debbugs.gnu.org; Mon, 02 Nov 2020 18:14:05 -0500 Received: by mail-ej1-f49.google.com with SMTP id o9so19175902ejg.1 for <37127@debbugs.gnu.org>; Mon, 02 Nov 2020 15:14:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:in-reply-to:references:mime-version:date:message-id:subject:to :content-transfer-encoding; bh=hOZacOigP8AvW1H98/a1MQs3XZsHQkskmFfpbZTxOew=; b=AsPx765fmN3sv/aCcEDDJ8jHgduDPdb4+gQfUGxDDTECeK3ZGlsgNv2pdm8scsHSyu n7wpASdYDNh6GQ5NiHC5SyRT1w3BWb3Qwfi9vwaRa3RmkkMg/4aWtcQXIB5zjOhFR18w y9mj+TtUKCODG30Vl/+Vr8Saj/7pWWnA3weIeUPhhlc07Y3VmlQ5jW7ntKNOTzKXTvP6 m61NiLexHc8OHIAcdGu6LmSTCXrQIKU4RPLphqln+Expl9ChFiFvSvLfFWxjBzi1GlVt t5rtdHacr0ZILk7qSVIO1ZQszkS+HrBDDAI8Xsbdv8QIPr2rDywbc+L1CQ2oQWt3jZc5 xNxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:in-reply-to:references:mime-version:date :message-id:subject:to:content-transfer-encoding; bh=hOZacOigP8AvW1H98/a1MQs3XZsHQkskmFfpbZTxOew=; b=BZu+McxCx+yrroNiJbn7310lZ15IUkIGM6ANl7Pbj40aEaidg9Xqj3xTcYHHFTsPrC WSGbMUdEh74cfgj2zc2YQKeUlFmLYA18CfZnSwsYNYTYPavz6Y9mPgqjuYs2injUVuMC xGbNzP3lH0X01LvQudjk4kU4dlUQKB0Btds3jZ5AhIvAO6a9qg4kz84LYurm8J8BfaKq je8y36GBlnfD62dwasTPFV914MkHLZGjen6MZ44wS6lcaErBIzyXaOPL4X9n1YS0x8uQ YHRDhznytwjF8G8yO+JraDAHa0AMhs+1hB7IohfIoxZkUIbRTaubHwsdJGInVFFhPGHN JlRg== X-Gm-Message-State: AOAM533oFQ8GjFr6MlK7XjkEjwsGfKRDQE3vHeRrpHSiKl9EfAhCdeTq Ld6NapjtNQP53IpFfvZcrTbzh2dbrx3fHUceotw= X-Google-Smtp-Source: ABdhPJwjlQYgEcdBb+KP130yYykeGPrtqXY/rhXN/8scSsRFNTOpaaOwcJXn2/prjGzgGWifB11cCzWnITFW9hRTRls= X-Received: by 2002:a17:906:519b:: with SMTP id y27mr16548090ejk.25.1604358839525; Mon, 02 Nov 2020 15:13:59 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 2 Nov 2020 23:13:58 +0000 From: Stefan Kangas In-Reply-To: <871rhbl6bb.fsf@hajtower> References: <87ftlu67cy.fsf@vinc17.net> <871rhbl6bb.fsf@hajtower> MIME-Version: 1.0 Date: Mon, 2 Nov 2020 23:13:58 +0000 Message-ID: Subject: Re: bug#37127: [PATCH] A final tweak: Skip the test for older Emacsen To: =?UTF-8?B?SGFyYWxkIErDtnJn?= , 37127@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37127 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) haj@posteo.de (Harald J=C3=B6rg) writes: > The current fix for this bug is in simple.el. This comes with the side > effect that it will not be available in older Emacs versions when CPerl > mode makes its way to GNU ELPA. > > The bug is completely harmless, I guess that porting the fix to older > versions isn't worth the effort. I suggest to just skip the test when > run under Emacs < 28, though this isn't strictly mandatory in the Emacs > repository. Makes sense, pushed to master as commit 2800513af5. From unknown Fri Aug 15 20:28:29 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 01 Dec 2020 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator