I'd like to disable
whitespace-mode while in evil insert state. The following hooks work, but require refreshing all font colors with
(font-lock-fontify-buffer), and even then- sometimes it fails to refresh properly to show trailing whitespace.
While this example uses evil-mode, similar logic applies to any other hook.
(defun i42/enter-insert-mode () (whitespace-mode -1) (font-lock-fontify-buffer)) (defun i42/exit-insert-mode () (whitespace-mode 1) (font-lock-fontify-buffer)) (add-hook 'evil-insert-state-entry-hook 'i42/enter-insert-mode) (add-hook 'evil-insert-state-exit-hook 'i42/exit-insert-mode)
Is there a better way to toggle white space mode?