From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely Date: Wed, 14 Sep 2022 19:52:45 +0200 Message-ID: <87k0654zde.fsf@gnus.org> References: <87a672j5li.fsf@dick> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34303"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 57804@debbugs.gnu.org, Paul Pogonyshev To: dick Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 14 19:53:39 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oYWZv-0008gt-9u for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Sep 2022 19:53:39 +0200 Original-Received: from localhost ([::1]:46684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oYWZu-0006EC-Bm for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Sep 2022 13:53:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYWZL-0005sN-LN for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2022 13:53:09 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39118) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oYWZL-00058E-DV for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2022 13:53:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oYWZK-0001A2-8o for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2022 13:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Sep 2022 17:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57804 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: wontfix Original-Received: via spool by 57804-submit@debbugs.gnu.org id=B57804.16631779764444 (code B ref 57804); Wed, 14 Sep 2022 17:53:02 +0000 Original-Received: (at 57804) by debbugs.gnu.org; 14 Sep 2022 17:52:56 +0000 Original-Received: from localhost ([127.0.0.1]:56049 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oYWZE-00019c-5F for submit@debbugs.gnu.org; Wed, 14 Sep 2022 13:52:56 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:52298) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oYWZC-00019N-MD for 57804@debbugs.gnu.org; Wed, 14 Sep 2022 13:52:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=CLvot890fhcIn92aUhRCMQpra3D7wcWuloEYyl9zxTQ=; b=sfKzg9uwu/HwynTSPDRX0HbqtL ZIMw5BNyYDiZjzs4IWNQjmrKBK23fx6RMoB1Z0Ial8mN0OkYnt56JMeCIIC+awgv9LR+cVTVcAgQ2 CrJfSa+FNyC3uQYBirddermnc0ERMLlmxfi9oQWSwL4ozr2Iu573Ou2rM/+kdgijfUG8=; Original-Received: from [84.212.220.105] (helo=joga) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oYWZ3-0000YD-V2; Wed, 14 Sep 2022 19:52:48 +0200 In-Reply-To: <87a672j5li.fsf@dick> (dick's message of "Wed, 14 Sep 2022 12:14:33 -0400") Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAALVBMVEXu7u3Y0NfGoK/P NkTdV2e3rsuZeYdLOkUTBw9kV14nEhlLJio2IiosGiP////Zf5E1AAAAAWJLR0QOb70wTwAAAAd0 SU1FB+YJDhEYCHAinlEAAAGOSURBVDjLrdK9TsJQFAfwYuJOE0kMkcHi4iq+AKUvwEA0xBV4Az4S WeV4oaNCBRcXLhe7Yk2ZhVSZ+xH6LrYF1J7WxMH/eH+959xzeznuKzz330nyPJ8Mr2Rzu5xtlxKC kD+RxKzkJ3cuSTvYE0VRkIRsTioUQju2OZB2yf/xPIlU9ZjfJAz7NbgpBSkiOJ0+xUPfaFXiIKUs G9/wY/pU8aESX6o0qsSXKtUqA9tbr96F4aLfrw5pS2nDbRjKzKR2GwAIgittDJN5DJTpmKrUA1zq EkyHAIlC2V3QWDj6WPt1SBRc1weg0R0r73tCZQwZdwlkOKXgIDhULZnN3y2QEaQpdHVdN2J6LLtz XVcdhnuoBmGMMAtDmvjDgRPZkWZTzYOXXhTWj8DgTXUjwEYe2E0jCg2v1HNzjU/F4BpkCosOBkJW /t3OiMmF3lWGBceFWdPGpZh35xQmA9wcZOIPYtcioAalVKWDwSLBr62bGOgGXhuoOQSPCmCi/ALd ezygBsw3gqGnseBhkTrHfQIpVOojvKi+iAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMi0wOS0xNFQx NzoyNDowOCswMDowMC0MBZkAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjItMDktMTRUMTc6MjQ6MDgr MDA6MDBcUb0lAAAAAElFTkSuQmCC X-Now-Playing: Anne Clark's _Hopeless Cases_: "Leaving" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:242503 Archived-At: --=-=-= Content-Type: text/plain dick writes: > jit-lock callbacks enjoy special status in that they're invoked > out-of-band in redisplay C code. That's probably why they're not > interruptible from the interpreter loop. If I remember correctly, the problem isn't really that `C-g' isn't able to break, but that we then call the redisplay immediately again, which then calls the font-locking code. Let's see... yes, with this slightly modified version of Paul's code, after hitting `C-g' eight times, I get a redisplay finally and it says "Called 8 times". So I think there's scope for us to do something practical here with this annoying problem. It's hard enough to develop font locking code without Emacs suddenly (and unbreakably) hanging on you when you've typed in some buggy code. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=font-lock-hangs.el Content-Transfer-Encoding: quoted-printable (define-derived-mode buggy-mode nil "buggy" (setf max-redisplay-ticks 100) (setf font-lock-defaults '(nil nil t nil (font-lock-fontify-region-functi= on . buggy-fontifier))) (font-lock-mode 1)) (defvar times 0) (defun buggy-fontifier (start end loudly) (message "Called %d times" (setq times (1+ times))) (add-face-text-property start (min (+ start 15) end) 'bold) (while t "whoopsie" (redisplay t)) nil) (switch-to-buffer "*scratch*") (dotimes (k 50) (insert "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do = eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad mini= m veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea c= ommodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit= esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupid= atat non proident, sunt in culpa qui officia deserunt mollit anim id est la= borum.\n\n")) (goto-char 1) (buggy-mode) --=-=-=--