Subject: Re: bug#21523: 25.0.50; Undo with active region adds extra text

From: Eli Zaretskii <[email-masked]>
Date: Mon, 16 Aug 2021 19:30:37 +0300

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Mon, 16 Aug 2021 15:53:55 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> This bug is still present in Emacs 28.
> >
> > Why is it a bug?  What is the expected "non-buggy" behavior in this
> > case?
> 
> I'd expect it to either do nothing (since we're undoing in a region, and
> the changed text is outside the region), or change the "This" to
> "this".  Leaving "Thisthis" in the buffer has to be a bug no matter how
> you look at it.

Is signaling an error okay?  Because then it looks like an off-by-one
error somewhere -- the following slightly modified recipe works as
expected:

  emacs -Q
  C-u 23 M-g c ; go to "text"
  M-c
  C-f          ; the crucial difference!
  C-SPC
  C-e
  C-/
    => user-error: No further undo information for region

So the problem seems to be that in the original recipe the region
starts immediately after the end of the modified portion of text.