From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#34525: replace-regexp missing some matches Date: Wed, 20 Feb 2019 17:07:22 +0000 Message-ID: <20190220170722.GA9655__11607.978287951$1550683685$gmane$org@ACM> References: <5a74a337-804e-2590-bffd-43a851f90240@gmail.com> <83zhqtjdtz.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="260362"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: Daniel Lopez , 34525@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 20 18:28:00 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gwVf3-0015ZT-JH for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Feb 2019 18:27:57 +0100 Original-Received: from localhost ([127.0.0.1]:44165 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwVf2-0004c3-E0 for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Feb 2019 12:27:56 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:40962) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwVPp-0007hs-7z for bug-gnu-emacs@gnu.org; Wed, 20 Feb 2019 12:12:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gwVPl-00080r-1z for bug-gnu-emacs@gnu.org; Wed, 20 Feb 2019 12:12:11 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57635) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gwVPe-0007vV-Gq; Wed, 20 Feb 2019 12:12:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gwVPe-00079a-26; Wed, 20 Feb 2019 12:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Wed, 20 Feb 2019 17:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34525 X-GNU-PR-Package: emacs,cc-mode Original-Received: via spool by 34525-submit@debbugs.gnu.org id=B34525.155068267727441 (code B ref 34525); Wed, 20 Feb 2019 17:12:02 +0000 Original-Received: (at 34525) by debbugs.gnu.org; 20 Feb 2019 17:11:17 +0000 Original-Received: from localhost ([127.0.0.1]:58401 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gwVOv-00078W-GM for submit@debbugs.gnu.org; Wed, 20 Feb 2019 12:11:17 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:36584 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1gwVOt-00078K-HG for 34525@debbugs.gnu.org; Wed, 20 Feb 2019 12:11:16 -0500 Original-Received: (qmail 42841 invoked by uid 3782); 20 Feb 2019 17:11:13 -0000 Original-Received: from acm.muc.de (p4FE15C3F.dip0.t-ipconnect.de [79.225.92.63]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 20 Feb 2019 18:11:12 +0100 Original-Received: (qmail 9860 invoked by uid 1000); 20 Feb 2019 17:07:22 -0000 Content-Disposition: inline In-Reply-To: <83zhqtjdtz.fsf@gnu.org> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:155590 Archived-At: Hello again, Eli. On Mon, Feb 18, 2019 at 17:50:16 +0200, Eli Zaretskii wrote: > > From: Daniel Lopez > > Date: Mon, 18 Feb 2019 08:28:35 +0000 > > - Start "emacs -Q" and open the file BitmapFontFace.h > > - Evaluate the expression (replace-regexp "\\" "SharedBitmap") > > - The text "Replaced 8 occurrences" appears in the echo area. > > Problem: > > There were actually 12 occurrences (ie. of the word "Bitmap" surrounded > > by word boundaries) in the file that should have been replaced. If I now > > move point back to the start of the buffer and evaluate the expression > > again, it says "Replaced 4 occurrences". > > The exact number of incorrect replacements perhaps varies over time. > > That is, I can test it five times in a row and get 8 initial replacments > > each time, but after trying some other search terms, messing with the > > file, restarting Emacs etc, I try my initial test again and then maybe > > it consistently replaces 10 the first time, for a while. So your exact > > numbers may vary. > C++ Mode plays some funky games with the syntax of '<', so maybe this > is the consequence. CC'ing Alan, in the hope that he might have > something interesting to say about this. I have a lot interesting to say about this. Firstly, it is a difficult bug. I see the bug in master and Emacs 26.1 but not on Emacs 25.3. For the latter two, I tested with both -Q and --no-desktop in the command line. The bug would thus appear to be independent of the CC Mode version in use. The bug is definitely some sort of interaction between the regexp "\\" and the opening template delimiter < in code lines such as: std::vector< Bitmap > m_bitmaps; ^ . If a space is inserted before the marked <, the bug doesn't happen. Neither does it happen if the < is removed altogether. That < has a category property whose symbol contains the syntax-table property "(> " (i.e. "open paren" syntax with matching paren being ">"). I have checked, with a throwaway testing command, that all the Thanks. -- Alan Mackenzie (Nuremberg, Germany).