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, 27 Feb 2019 17:10:36 +0000 Message-ID: <20190227171036.GF4772@ACM> References: <83bm35hkqo.fsf@gnu.org> <20190224173746.GA21808@ACM> <83mumlnk8y.fsf@gnu.org> <20190224210058.GB21808@ACM> <83mumjmxv6.fsf@gnu.org> <20190226135048.GA19653@ACM> <20190227142251.GB4772@ACM> <20190227150849.GC4772@ACM> 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="221113"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: daniel.lopez999@gmail.com, 34525@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 27 18:16:15 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 1gz2oX-000vL0-50 for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Feb 2019 18:16:13 +0100 Original-Received: from localhost ([127.0.0.1]:47824 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gz2oW-0001gT-49 for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Feb 2019 12:16:12 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:49344) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gz2oO-0001g1-Om for bug-gnu-emacs@gnu.org; Wed, 27 Feb 2019 12:16:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gz2oM-0007o9-SK for bug-gnu-emacs@gnu.org; Wed, 27 Feb 2019 12:16:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40732) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gz2oL-0007nV-Uo; Wed, 27 Feb 2019 12:16:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gz2oL-0005SP-M5; Wed, 27 Feb 2019 12:16:01 -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, 27 Feb 2019 17:16:01 +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.155128773520941 (code B ref 34525); Wed, 27 Feb 2019 17:16:01 +0000 Original-Received: (at 34525) by debbugs.gnu.org; 27 Feb 2019 17:15:35 +0000 Original-Received: from localhost ([127.0.0.1]:54276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gz2nu-0005Rg-Ow for submit@debbugs.gnu.org; Wed, 27 Feb 2019 12:15:35 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:12230 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1gz2ns-0005RX-1D for 34525@debbugs.gnu.org; Wed, 27 Feb 2019 12:15:32 -0500 Original-Received: (qmail 53198 invoked by uid 3782); 27 Feb 2019 17:15:25 -0000 Original-Received: from acm.muc.de (p4FE15D59.dip0.t-ipconnect.de [79.225.93.89]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 27 Feb 2019 18:15:22 +0100 Original-Received: (qmail 23546 invoked by uid 1000); 27 Feb 2019 17:10:36 -0000 Content-Disposition: inline In-Reply-To: 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:155859 Archived-At: Hello, Stefan. On Wed, Feb 27, 2019 at 10:40:19 -0500, Stefan Monnier wrote: > >> Here, in seeking the next interval, we go down a chain of `left's. We > >> do not set the ->position field of these intervals, except for the last > >> one, which we return. > >> So the returned interval doesn't satisfy the condition that all its > >> parents have their ->position's set correctly. > [...] > > I've done this, and it appears to have fixed the bug. :-) > AFAICT the only place where we need the parents to have > a valid ->position is in update_interval. So maybe another fix is to > change update_interval so it computes the parent's ->position rather > than rely on it having the right value. I'll think about this. > I personally don't have a preference and I'm not sure which option would > be better performancewise. I've done some speed testing with my function M-: (time-scroll), which scrolls through a buffer a screenful at a time, redisplaying each place it stops. On xdisp.c, there was no detectable difference between versions with the bug fix and without. On a largish C++ file with lots of template delimiters, the corrected version was about 4% slower on unoptimised builds. Between comparable optimised builds, the differences were not detectable. > If we opt (like your patch does) to have the invariant that > the ->position of parents is kept up-to-date, then maybe we should > change find_interval to guarantee this (which would basically be > a matter of moving the corresponding code from update_syntax_table where > we update the parents's ->position after calling find_interval) ? This would be an excellent idea, something I was going to suggest myself. :-) > Stefan -- Alan Mackenzie (Nuremberg, Germany).