From: Eshel Yaron Date: Thu, 29 Sep 2022 17:38:58 +0000 (+0300) Subject: ENHANCED: only fontify visible sweeprolog-mode buffers on idle X-Git-Tag: v0.4.2~8 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=13c75510158faffc45e5391a77a6b077ee26e8dc;p=dict.git ENHANCED: only fontify visible sweeprolog-mode buffers on idle --- diff --git a/sweeprolog.el b/sweeprolog.el index 03593e4..1f03c2c 100644 --- a/sweeprolog.el +++ b/sweeprolog.el @@ -2143,14 +2143,18 @@ Interactively, POINT is set to the current point." (add-hook 'file-name-at-point-functions #'sweeprolog-file-at-point nil t) (add-hook 'completion-at-point-functions #'sweeprolog-completion-at-point-function nil t) (when sweeprolog-colourise-buffer-on-idle - (setq sweeprolog--timer (run-with-idle-timer (max sweeprolog-colourise-buffer-min-interval - (* 10 sweeprolog--colourise-buffer-duration)) - t - (let ((buffer (current-buffer))) - (lambda () - (unless (< sweeprolog-colourise-buffer-max-size - (buffer-size buffer)) - (sweeprolog-colourise-buffer buffer)))))) + (setq sweeprolog--timer + (run-with-idle-timer + (max sweeprolog-colourise-buffer-min-interval + (* 10 sweeprolog--colourise-buffer-duration)) + t + (let ((buffer (current-buffer))) + (lambda () + (when (and (buffer-live-p buffer) + (not (< sweeprolog-colourise-buffer-max-size + (buffer-size buffer))) + (get-buffer-window buffer)) + (sweeprolog-colourise-buffer buffer)))))) (add-hook 'kill-buffer-hook (lambda () (when (timerp sweeprolog--timer)