Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

font-locking is slow #142

Open
PythonNut opened this issue Feb 18, 2021 · 0 comments
Open

font-locking is slow #142

PythonNut opened this issue Feb 18, 2021 · 0 comments

Comments

@PythonNut
Copy link
Owner

Scrolling tends to lock up.
There is evidence that this slowness is caused by

  • rainbow-delimiters
  • adaptive-wrap-prefix-mode

Here is a very dubious piece of code to disable rainbow-delimiters mode JIT.

(defvar quark/rainbow-delimiters-temp-disabled nil)

(defun quark/temp-disable-rainbow-delimiters (_window _pos)
  (unless quark/rainbow-delimiters-temp-disabled
    ;; (font-lock-flush)
    (font-lock-remove-keywords nil rainbow-delimiters--font-lock-keywords)
    (setq quark/rainbow-delimiters-temp-disabled t)))

(defun quark/temp-enable-rainbow-delimiters ()
  (when quark/rainbow-delimiters-temp-disabled
    (font-lock-flush)
    (font-lock-add-keywords nil rainbow-delimiters--font-lock-keywords 'append)
    (setq quark/rainbow-delimiters-temp-disabled nil)))

(add-hook 'window-scroll-functions #'quark/temp-disable-rainbow-delimiters)
(run-with-idle-timer 0.05 t #'quark/temp-enable-rainbow-delimiters)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant