GNU bug report logs - #76108
Call `modify_text' only on the text being replaced in `subst-char-in-region'

Previous Next

Package: emacs;

Reported by: Thuna <thuna.cing <at> gmail.com>

Date: Thu, 6 Feb 2025 23:42:01 UTC

Severity: normal

Full log


Message #29 received at 76108 <at> debbugs.gnu.org (full text, mbox):

From: Thuna <thuna.cing <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 76108 <at> debbugs.gnu.org
Subject: Re: bug#76108: Call `modify_text' only on the text being replaced
 in `subst-char-in-region'
Date: Sat, 08 Feb 2025 19:42:37 +0100
>> Now, I am not entirely sure how I've managed to miss this, but
>> `subst-char-in-region' actually _also_ messes up the after calls.  I
>> have no idea how or why this is happening, but a buffer whose contents
>> are
>>
>>   "foo bar\nquux baz ban"
>>
>> with an overlay from 14 to 17 (that is, around the word "baz") with the
>> modification hook
>>
>>   (lambda (&rest args) (print args))
>>
>> reports being called with the arguments
>>
>>   (#<overlay from 17 to 17 in temp> nil 8 21)
>>   (#<overlay from 14 to 17 in temp> t 8 9 1)
>>
>> when I do
>>
>>   (subst-char-in-region (point-min) (point-max) ?\n ?\s)
>
> The `nil 8 21` and `t 8 9 1` are the values I'd expect, but the `17 to
> 17` seems very odd and the fact that the hook is called at all for the
> "after" case sounds like a bug, as you point out.

It doesn't change anything but I should make a correction: That first
case is also an overlay from 14 to 17.




This bug report was last modified 125 days ago.

Previous Next


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