GNU bug report logs - #57804
An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely

Previous Next

Package: emacs;

Reported by: Paul Pogonyshev <pogonyshev <at> gmail.com>

Date: Wed, 14 Sep 2022 15:07:01 UTC

Severity: normal

Tags: wontfix

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Paul Pogonyshev <pogonyshev <at> gmail.com>
Cc: 57804 <at> debbugs.gnu.org
Subject: Re: bug#57804: An infinite loop in a `fontify-region' function
 causes Emacs to hang indefinitely
Date: Wed, 14 Sep 2022 18:41:53 +0200
Paul Pogonyshev <pogonyshev <at> 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?




This bug report was last modified 2 years and 231 days ago.

Previous Next


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