reddit / emacs

[ANN] jit-lock-stealth-progress (show font locking progress while idle in the mode-line)

ideasman_42 · 2022-08-29 09:29
sigsegv0xb · 2022-08-29 22:53
Honest question, what types of buffers are you dealing with where font locking takes a noticeable amount of time? Are these source code buffers, and if so, how big are they?
ideasman_42 · 2022-08-30 00:25
Syntax highlighting for the language it's self is mostly fine without `jit-lock-stealth`. This most useful for contextual font locking. * Highlight all on-screen misspelled words [spell-fu](https://codeberg.org/ideasman42/emacs-spell-fu). * Highlight indentation [hl-indent-scope](https://codeberg.org/ideasman42/emacs-hl-indent-scope) * Highlight documentation in code-comments. Take the example of spelling for e.g. If I run this as part of regular font-locking, it will noticeably slow down showing large blocks of text, as every word needs to be checked. So, it's mostly fine to run on idle (half a second or less). However, its *even nicer* if it's already calculated, which is what `jit-lock-stealth-nice` handles for the most-part. So I can quickly jump to a new location in the buffer with everything highlighted, it makes navigating snappier and I can include more information via overlays/font-locking without it making emacs feel sluggish when quickly scrolling or jumping between search results. As for how big these buffers are, roughly over 2k lines I find showing the progress to be useful, so I'm aware any slight sluggishness is caused by unfinished font locking and not something else.