Skip to content

Commit 42f744f

Browse files
committed
hl-todo-mode: Speed up
Previously, in an effort to speed up the process, we didn't refontify the whole buffer. Instead we only added our additional fontification. However, we did not try to limit the latter to parts that were already fontified. Instead we searched the whole buffer, and that is costly too. Now we discard all existing fontification and then immediately refontify the visible portion using all keywords, including but not limited to, the ones that we just added. Other parts of the buffer are refontified lazily. Re-enabling `jit-lock-mode' does all that. Closes #61.
1 parent d13a089 commit 42f744f

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

Diff for: hl-todo.el

+1-5
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,7 @@ including alphanumeric characters, cannot be used here."
264264
(hl-todo--setup)
265265
(font-lock-remove-keywords nil hl-todo--keywords))
266266
(when font-lock-mode
267-
(save-excursion
268-
(goto-char (point-min))
269-
(while (hl-todo--search)
270-
(save-excursion
271-
(font-lock-fontify-region (match-beginning 0) (match-end 0) nil))))))
267+
(jit-lock-mode 1)))
272268

273269
;;;###autoload
274270
(define-globalized-minor-mode global-hl-todo-mode

0 commit comments

Comments
 (0)