rainbow-blocks
rainbow-blocks copied to clipboard
Colors occasionally disappear?
Hello,
First of all, I'd like to thank you for contributing this plugin! I found it exceptionally useful at quickly perusing the structure of my Lisp code (and quite pretty). Great work!
I've noticed occasionally (and in a way that's hard to reproduce) while editing code or scrolling in my buffer, the rainbow colors seem to sometimes temporarily disappear. They'll re-appear if I modify the code blocks in question, or sometimes, just wait a moment. I was curious if you've ever seen this, and if so, if you know of a quick way to fix? (I've tried byte compiling the file, and I'm running on a fairly fast machine).
Thanks again for your hard work!
Best, Steve
Hi Steve,
I haven't experienced this. Would be useful if you had more clues on what circumstances cause this. How long (and how deeply nested) are the source files? Of out interest too, what language are you using it with?
I think I should rebase the code against the top of the forked repo (rainbow-delimiters) anyway
Thanks for the reply, Stéphane!
Sure, here's a bit more information. I've been running rainbow-blocks
in Common Lisp files. Specifically, it's automatically activated in my .emacs
file via:
(require 'rainbow-blocks)
(add-hook 'lisp-mode-hook 'rainbow-blocks-mode)
The files I've been editing are moderately large (close to 1000 lines), and do have some moderate nesting (maybe max around 9 levels or so).
Thanks again for any help you may have time to provide, it's much appreciated!
Best, Steve
@istib I encountered the same problem as @sjlevine . Sometimes the rainbow colors disappear when I edit source file. Besides, my source file is small, it is about 30 lines and max nest is about 6 levels. When I reopen the file the rainbow color appears. I think the problem only appears when I edit source code.
I think this is an issue in the jit-font-face stuff, if I modify rainbow mode's propertize function/callback to operate on its own defined start/end (instead of what jit- passes it) and use something like (window-start) and (window-end), the issue seems to go away.
I believe it has to do with how the mode attempts to count parenthesis in a visible region vs the entire buffer at once.
Alternatively, calling (font-lock-flush) from M-: will fix it (or font-lock-fontify-buffer).