From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#52297: 29.0.50; Error in c-force-redisplay timer Date: Wed, 9 Feb 2022 20:06:18 +0000 Message-ID: References: <83tufn4ilg.fsf@gnu.org> <874k59r7ef.fsf@gnus.org> <771e57fc-7af5-a069-3165-37f9a98fdc87@gmx.at> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20593"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, Lars Ingebrigtsen , 52297@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 09 21:11:27 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 1nHtJH-0005E8-Dw for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 09 Feb 2022 21:11:27 +0100 Original-Received: from localhost ([::1]:53008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nHtJF-0006UN-S4 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 09 Feb 2022 15:11:25 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33790) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHtF0-0003yJ-Ra for bug-gnu-emacs@gnu.org; Wed, 09 Feb 2022 15:07:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58928) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nHtF0-0002AU-Ho for bug-gnu-emacs@gnu.org; Wed, 09 Feb 2022 15:07:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nHtF0-0006ex-7c for bug-gnu-emacs@gnu.org; Wed, 09 Feb 2022 15:07:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 09 Feb 2022 20:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52297 X-GNU-PR-Package: emacs Original-Received: via spool by 52297-submit@debbugs.gnu.org id=B52297.164443718825530 (code B ref 52297); Wed, 09 Feb 2022 20:07:02 +0000 Original-Received: (at 52297) by debbugs.gnu.org; 9 Feb 2022 20:06:28 +0000 Original-Received: from localhost ([127.0.0.1]:52825 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nHtES-0006di-1Y for submit@debbugs.gnu.org; Wed, 09 Feb 2022 15:06:28 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:27848 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1nHtEQ-0006dS-6Q for 52297@debbugs.gnu.org; Wed, 09 Feb 2022 15:06:26 -0500 Original-Received: (qmail 98732 invoked by uid 3782); 9 Feb 2022 20:06:19 -0000 Original-Received: from acm.muc.de (p4fe15d53.dip0.t-ipconnect.de [79.225.93.83]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 09 Feb 2022 21:06:19 +0100 Original-Received: (qmail 9759 invoked by uid 1000); 9 Feb 2022 20:06:18 -0000 Content-Disposition: inline In-Reply-To: <771e57fc-7af5-a069-3165-37f9a98fdc87@gmx.at> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de 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:226504 Archived-At: Hello again, Martin. On Wed, Feb 09, 2022 at 19:21:20 +0100, martin rudalics wrote: > > Thanks. With that file, I can reproduce the bug. I'll set about fixing > > it. > TIA, martin I think the problem is that the buffer wasn't set in the timer function, so c-force-redisplay was, in the bug scenario, trying to fontify a spurious buffer. Would you try out the following patch, please, which fixes this bug. I'm optimistic it will have fixed the main bug. Thanks! diff -r 67fe5c0a9d03 cc-fonts.el --- a/cc-fonts.el Mon Jan 31 17:34:20 2022 +0000 +++ b/cc-fonts.el Wed Feb 09 19:58:26 2022 +0000 @@ -2256,12 +2256,13 @@ ;; redisplay. (defvar c-re-redisplay-timer nil) -(defun c-force-redisplay (start end) +(defun c-force-redisplay (buffer start end) ;; Force redisplay immediately. This assumes `font-lock-support-mode' is ;; 'jit-lock-mode. Set the variable `c-re-redisplay-timer' to nil. - (save-excursion (c-font-lock-fontify-region start end)) - (jit-lock-force-redisplay (copy-marker start) (copy-marker end)) - (setq c-re-redisplay-timer nil)) + (with-current-buffer buffer + (save-excursion (c-font-lock-fontify-region start end)) + (jit-lock-force-redisplay (copy-marker start) (copy-marker end)) + (setq c-re-redisplay-timer nil))) (defun c-fontify-new-found-type (type) ;; Cause the fontification of TYPE, a string, wherever it occurs in the @@ -2291,6 +2292,7 @@ (not c-re-redisplay-timer)) (setq c-re-redisplay-timer (run-with-timer 0 nil #'c-force-redisplay + (current-buffer) (match-beginning 0) (match-end 0))))))))))) -- Alan Mackenzie (Nuremberg, Germany).