GNU bug report logs - #42424
27.0.90; replace-match: point is NOT left at the end of replacement

Previous Next

Package: emacs;

Reported by: Ren Victor <victorhge <at> gmail.com>

Date: Sun, 19 Jul 2020 05:53:02 UTC

Severity: normal

Tags: patch

Found in version 27.0.90

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Ren Victor <victorhge <at> gmail.com>
Cc: 42424 <at> debbugs.gnu.org
Subject: bug#42424: 27.0.90; replace-match: point is NOT left at the end of replacement
Date: Tue, 09 Apr 2024 11:14:35 -0400
> This issue happens when modification hooks modify the text before the
> end of replacement text.

Modification hooks which modify the buffer text are just getting what
they deserve.

> But the end of replacement might be changed inside of `replace_range'.
> So the final movement of point may end up to a wrong place.

This is just one of the many problems.

> Other types of modification (insert or delete) do not have this issue.
> `point' is adjusted before running modification hooks.

Yes, occasionally doing bad things won't bite you in the rear.
That doesn't justify doing those things.

If you want to modify the buffer in response to other buffer
modifications, then record this fact in the modification hook and then
act on it later, e.g. in a timer.
Anything else *will* cause problems sooner or later.


        Stefan





This bug report was last modified 1 year and 120 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.