From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii 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 20:25:32 +0300 Message-ID: <83tuussr1v.fsf@gnu.org> References: <87zh4ltc5l.fsf@gnus.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1991"; mail-complaints-to="usenet@ciao.gmane.io" Cc: victorhge@gmail.com, 42424@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 17 19:26:09 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 1kTpy5-0000NL-4W for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Oct 2020 19:26:09 +0200 Original-Received: from localhost ([::1]:51158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kTpy4-0002vk-7k for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Oct 2020 13:26:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36752) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTpxy-0002vd-Fh for bug-gnu-emacs@gnu.org; Sat, 17 Oct 2020 13:26:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52146) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kTpxy-0000RT-6c for bug-gnu-emacs@gnu.org; Sat, 17 Oct 2020 13:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kTpxy-0001Xp-2t for bug-gnu-emacs@gnu.org; Sat, 17 Oct 2020 13:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Oct 2020 17:26: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.16029555435914 (code B ref 42424); Sat, 17 Oct 2020 17:26:02 +0000 Original-Received: (at 42424) by debbugs.gnu.org; 17 Oct 2020 17:25:43 +0000 Original-Received: from localhost ([127.0.0.1]:35459 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kTpxf-0001XK-D5 for submit@debbugs.gnu.org; Sat, 17 Oct 2020 13:25:43 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:58150) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kTpxd-0001X5-2m for 42424@debbugs.gnu.org; Sat, 17 Oct 2020 13:25:42 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:58803) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kTpxX-0000Q1-9T; Sat, 17 Oct 2020 13:25:35 -0400 Original-Received: from [176.228.60.248] (port=2103 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kTpxV-00081f-54; Sat, 17 Oct 2020 13:25:34 -0400 In-Reply-To: <87zh4ltc5l.fsf@gnus.org> (message from Lars Ingebrigtsen on Sat, 17 Oct 2020 11:49:42 +0200) 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:190823 Archived-At: > From: Lars Ingebrigtsen > Date: Sat, 17 Oct 2020 11:49:42 +0200 > Cc: 42424@debbugs.gnu.org > > /* 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? Yes, it should say "end", not "start". > /* 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? Personally, I wonder what was expected here. If the modification hooks modify the replaced text behind our back, how can the Lisp program which does that expect to have point where it belongs? Am I missing something?