GNU bug report logs - #77942
31.0.50; replace-region-contents gets stuck

Previous Next

Package: emacs;

Reported by: Gerd Möllmann <gerd.moellmann <at> gmail.com>

Date: Sun, 20 Apr 2025 15:30:07 UTC

Severity: normal

Found in version 31.0.50

Full log


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

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 77942 <at> debbugs.gnu.org
Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck
Date: Mon, 21 Apr 2025 22:42:16 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> Gerd Möllmann [2025-04-21 20:01:43] wrote:
>> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>>>> This enters an (infinite?) loop
>>>
>>> AFAICT it's not infinite.  At least, it does end for me when the buffer
>>> is smaller (100000) and it does take more time (but still end) with
>>> a buffer of 500000, so I think it would end *eventually*.
>>
>> Just as an observation: I started with 1 run and that seemed reasonably
>> fast, a few seconds, so I made it 100, which had this effect.
>
> For the first round, how fast is it depends on your luck with the random
> number generator since the time depends on the size of the region on
> which you perform the replace.
>
> Try just
>
>     (require 'subr-x)
>     
>     (defun elb-replace-region-contents-entry ()
>       (with-temp-buffer
>         (let ((step (apply #'concat (make-list 2000 "🙂été👶🏿 "))))
>           (dotimes (_ (/ 1000000 (length step)))
>             (insert step)))
>     
>         (replace-region-contents 123 (- (point-max) 123)
>                                  (lambda () "🙂été👶🏿 🙂été👶🏿 "))))
>

Yep, I've read the code now, and the O(ND) diffing was, well, a bit
suprising :-).




This bug report was last modified 56 days ago.

Previous Next


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