From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#73018: 31.0.50; wdired + replace-regexp only modifies the visible portion of the buffer Date: Tue, 10 Sep 2024 09:27:31 -0400 Message-ID: References: <20240904.080321.1100373523429404965.enometh@meer.net> <87seug85hh.fsf@web.de> <86y147gzx0.fsf@mail.linkov.net> <874j6uz4d8.fsf@web.de> <86ed5yujq3.fsf@mail.linkov.net> <87v7z9rnrp.fsf@web.de> <87o750dats.fsf@web.de> <868qw2ruv3.fsf@mail.linkov.net> <87bk0w511c.fsf@web.de> <86a5gg7nrs.fsf@mail.linkov.net> <86tteo3wmh.fsf@mail.linkov.net> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36336"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Michael Heerdegen , Madhu , 73018@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 10 15:28:22 2024 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 1so0us-0009Gx-9u for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 10 Sep 2024 15:28:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so0ub-0004wq-FN; Tue, 10 Sep 2024 09:28:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so0uU-0004wC-5b for bug-gnu-emacs@gnu.org; Tue, 10 Sep 2024 09:27:59 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so0uT-0002G3-5G for bug-gnu-emacs@gnu.org; Tue, 10 Sep 2024 09:27:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=pwVuiH9EdDVUjxqhajW03gRbrIXa2FfvrBnI+VdYBnQ=; b=mNZXJIzwt/bwsc+76tClPNPVamTYsGerP/JWRRwniaw3I88hWmfRLNS84njBrNIDvwB5RpoUIatY4N8rj/BhK7IJKCiSp8hz9VX2o5z0kho60FlrGFlAzPVqEM9YzAiyfQQyrurBggVy7rC9T4ntSLWR7aq2Q4Xy5i7thpR6jH395lawonjH88JGnHWt/6IOGAFqSidvl6gtW4xuoJtmizPxrHYaZi6LfEdKBVl6xAVqF637gGqcNNPpfWksHwHcdp/PUzkKBlgEYgtPnXXeml10Nyf3heGqes2tkUKaNzDRHDjjFVrrRulhnuXxS7YxG+/ydHOErlyGL6keRmGt5w==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1so0uY-0003bj-3H for bug-gnu-emacs@gnu.org; Tue, 10 Sep 2024 09:28:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 10 Sep 2024 13:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73018 X-GNU-PR-Package: emacs Original-Received: via spool by 73018-submit@debbugs.gnu.org id=B73018.172597486513837 (code B ref 73018); Tue, 10 Sep 2024 13:28:02 +0000 Original-Received: (at 73018) by debbugs.gnu.org; 10 Sep 2024 13:27:45 +0000 Original-Received: from localhost ([127.0.0.1]:35074 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1so0uH-0003b7-H2 for submit@debbugs.gnu.org; Tue, 10 Sep 2024 09:27:45 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:45060) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1so0uG-0003ap-3e for 73018@debbugs.gnu.org; Tue, 10 Sep 2024 09:27:44 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 653EA4412D7; Tue, 10 Sep 2024 09:27:33 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1725974851; bh=GtrvmINFnkJGuwV5Q8bGcN7qdAKDaFr1VASOy0dx/lI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=RUiCoH4D65G3HA99da1BS6e1/SXmINkYxfT7qx/oBZKlrmGHP1UirT5Fnk3xi3AAQ p4OLcBckoNa1SdQe0tbA3yvsUH7wIdvCks6gZpkVMOrfxtqituKpPC//eRCcskU0xr lomftDR7obvnFNNlFav0oUYNPvK6PGptlMYO/ppVWsAjuV1d9FuNtZbca/fzxPWvxS j/WPpcBgw5gq4ddRUPaLkBszb9cdF12ZuEjJRcEv95WktqV8mc8QvdpHIxjcT1exip 3xYDMlvoCRKjCDN6fOeheFqakUsItg0hNpOll4VrcyLxgD8DY5jYfBsuNYAvs3MtmA yF33RhTR7IENA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id D134A4412A5; Tue, 10 Sep 2024 09:27:31 -0400 (EDT) Original-Received: from pastel (104-195-217-100.cpe.teksavvy.com [104.195.217.100]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id A796D12020E; Tue, 10 Sep 2024 09:27:31 -0400 (EDT) In-Reply-To: (Stefan Monnier's message of "Tue, 10 Sep 2024 09:21:46 -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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:291563 Archived-At: > We should probably use something like > > ptrdiff_t > search_regs_last_reg (void) > { > ptrdiff_t i = search_regs.num_regs - 1; > while (i >= 0 && search_regs.start[i] < 0) > i--; > return i; > } > > instead of `search_regs.num_regs`. And maybe we should consider changing `struct re_search` to keep track of the last non-nil subgroup. Currently, things like `match-data` loop through all the elements of `search_regs` whose size depends on the size (in number of subgroups) of the largest regexp we have ever matched so far, rather than the actual number of subgroups currently in use, so there's some wasted work there. Maybe the cost of maintaining the "last reg" would pay off. Stefan