unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: martin rudalics <rudalics@gmx.at>
Cc: acm@muc.de, Lars Ingebrigtsen <larsi@gnus.org>, 52297@debbugs.gnu.org
Subject: bug#52297: 29.0.50; Error in c-force-redisplay timer
Date: Wed, 9 Feb 2022 20:06:18 +0000	[thread overview]
Message-ID: <YgQeum+ZCgaK7HoO@ACM> (raw)
In-Reply-To: <771e57fc-7af5-a069-3165-37f9a98fdc87@gmx.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)))))))))))
 
 \f


-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2022-02-09 20:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-05  7:27 bug#52297: 29.0.50; Error in c-force-redisplay timer Eli Zaretskii
2021-12-06 20:26 ` Alan Mackenzie
2022-02-08 10:15   ` Lars Ingebrigtsen
2022-02-08 18:36     ` Alan Mackenzie
2022-02-08 19:00       ` Eli Zaretskii
2022-02-09  8:45       ` martin rudalics
2022-02-09 16:53         ` Alan Mackenzie
2022-02-09 18:21           ` martin rudalics
2022-02-09 20:06             ` Alan Mackenzie [this message]
2022-02-10  8:26               ` martin rudalics
2022-02-10 17:15                 ` bug#52709: [ was: bug#52297: 29.0.50; Error in c-force-redisplay timer ] Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YgQeum+ZCgaK7HoO@ACM \
    --to=acm@muc.de \
    --cc=52297@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).