bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#57804: An infinite loop in a `fontify-region' function causes Emacs


From: Lars Ingebrigtsen
Subject: bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely
Date: Wed, 14 Sep 2022 18:41:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Paul Pogonyshev <pogonyshev@gmail.com> writes:

> C-g doesn't help anymore. The only thing you can do is to kill and start 
> Emacs anew.

[...]

> (define-derived-mode buggy-mode nil "buggy"
>   (setf font-lock-defaults '(nil nil t nil (font-lock-fontify-region-function 
> . buggy-fontifier)))
>   (font-lock-mode 1))
>
> (defun buggy-fontifier (start end loudly)
>   (add-face-text-property start (min (+ start 15) end) 'bold)
>   (while t
>     "whoopsie")
>   nil)

Yes, it's really unfortunate that you can't get out of errors like this
without killing Emacs.

We've previously discussed making a certain key sequence disable font
locking in a buffer -- or blacklist the particular functions that's
inflooping somehow.

For instance, if the user hits `C-g' three times (and Emacs doesn't idle
in between), then we disable font-lock in that buffer.

There's also `max-redisplay-ticks' -- but I'm not sure that would have
helped here?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]