From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#42424: 27.0.90; replace-match: point is NOT left at the end of replacement Date: Sat, 17 Oct 2020 11:49:42 +0200 Message-ID: <87zh4ltc5l.fsf@gnus.org> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28957"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 42424@debbugs.gnu.org To: Ren Victor Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 17 11:50:29 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 1kTir6-0007Og-Qk for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Oct 2020 11:50:28 +0200 Original-Received: from localhost ([::1]:45532 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kTir5-0001Nu-Pk for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Oct 2020 05:50:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTiqg-0001Ng-OT for bug-gnu-emacs@gnu.org; Sat, 17 Oct 2020 05:50:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50049) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kTiqg-0000tB-FB for bug-gnu-emacs@gnu.org; Sat, 17 Oct 2020 05:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kTiqg-0002P1-6s for bug-gnu-emacs@gnu.org; Sat, 17 Oct 2020 05:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Oct 2020 09:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42424 X-GNU-PR-Package: emacs Original-Received: via spool by 42424-submit@debbugs.gnu.org id=B42424.16029281959218 (code B ref 42424); Sat, 17 Oct 2020 09:50:02 +0000 Original-Received: (at 42424) by debbugs.gnu.org; 17 Oct 2020 09:49:55 +0000 Original-Received: from localhost ([127.0.0.1]:33362 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kTiqZ-0002Oc-9A for submit@debbugs.gnu.org; Sat, 17 Oct 2020 05:49:55 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:38346) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kTiqX-0002OO-Af for 42424@debbugs.gnu.org; Sat, 17 Oct 2020 05:49:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: 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=nhHZ1pGYzn9tEhB71/lvc+a5OlFoTw/u30iAzKFmceQ=; b=Z9Jr/h5OXqFWntt2sE1GEmOZlP 7iYmjjrFR52s1I0Mtr+wLdQ1Bjcn8867KDDPzqCYJUpuVhMGXxTj5FzGraoLjMhL5MmT20s9thAAu BZ7ya7JBbprzA1mSnZTp0fTPHvKzdoa/Scak51MWL+gtNXtfiHRlVBCbFIIyHqbjaf24=; Original-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 1kTiqO-0002Bt-69; Sat, 17 Oct 2020 11:49:46 +0200 X-Now-Playing: Machinedrum's _Vapor City Citizenship Programme_: "Vapor City - Vizion Centre Mix" In-Reply-To: (Ren Victor's message of "Sun, 19 Jul 2020 13:50:51 +0800") 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:190792 Archived-At: Ren Victor writes: > In `replace_range', the point is also relocated. I am not sure why it has > to be moved again just before returning from `replace-match'. I can reproduce this error on Emacs 28. The problem seems to be this in Freplace_match? /* Put point back where it was in the text, if possible. */ TEMP_SET_PT (clip_to_bounds (BEGV, opoint + (opoint <= 0 ? ZV : 0), ZV)); /* Now move point "officially" to the start of the inserted replacement. */ move_if_not_intangible (newpoint); Uhm... is that comment wrong? Aren't we moving point to the end of the inserted replacement? Anyway, removing that move makes the suggested test not fail, but it leads to a bunch of other tests failing, so it's doing something right, at least. However, just before that, there's this: /* The replace_range etc. functions can trigger modification hooks (see signal_before_change and signal_after_change). Try to error out if these hooks clobber the match data since clobbering can result in confusing bugs. Although this sanity check does not catch all possible clobberings, it should catch many of them. */ if (! (search_regs.num_regs == num_regs && search_regs.start[sub] == newstart && search_regs.end[sub] == newpoint)) error ("Match data clobbered by buffer modification hooks"); So replace_match is already signalling some errors on buffer modification hooks, but not here. So is this a bug or just something that should be documented better? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no