emacs-diffs
[Top][All Lists]
Advanced

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

master 6548286446: Note current buffer and restore it in c-force-redispl


From: Alan Mackenzie
Subject: master 6548286446: Note current buffer and restore it in c-force-redisplay.
Date: Thu, 10 Feb 2022 12:05:57 -0500 (EST)

branch: master
commit 65482864460677b74ec7a4609df14289393c1d22
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>

    Note current buffer and restore it in c-force-redisplay.
    
    This fixes bug #52709.
    
    * lisp/progmodes/cc-fonts.el (c-force-redisplay): New parameter BUFFER.  Set
    current buffer to this before fontifying.
    (c-fontify-new-found-type): Give the current buffer as argument to
    run-with-timer.
---
 lisp/progmodes/cc-fonts.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 230d39efee..15e3beb837 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -2253,12 +2253,13 @@ higher."
 ;; 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
@@ -2288,6 +2289,7 @@ higher."
                         (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)))))))))))
 
 



reply via email to

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