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 #17 received at 77942 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: 77942 <at> debbugs.gnu.org
Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck
Date: Mon, 21 Apr 2025 16:31:45 -0400
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é👶🏿 "))))


- Stefan





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.