Caused by over-zealous doom-switch-window-hook.
For my own sanity (and if you're curious), I'll break it down here:
1. Doom has a `doom-switch-window-hook` hook. It triggers when window
focus is changed.
2. We use `buffer-list-update-hook` to trigger
`doom-switch-window-hook`. (That may sound weird, but this hook is
reliably executed when window focus is changed -- there are
safeguards to prevent this from triggering too often)
3. `buffer-list-update-hook` triggers whenever a buffer is created, but
`doom-switch-window-hook` only triggers if the created buffer is in
a new window.
4. The use of `with-temp-buffer` in `centaur-tabs-line-format` counts as
"buffer creation" in a "new window".
5. `+vc-gutter-update-h` is in `doom-switch-window-hook`. This refreshes
git-gutter, which initiates a redraw of Emacs.
6. When Emacs redraws, it recalculates its mode and header lines. which
triggers `doom-switch-window-hook` once, which triggers
`+vc-gutter-update-h`, which redraws the screen, then Emacs recalculates
the header line, running `centaur-tabs-line-format`...
Infinite loop ensues
Hopefully fixes:
- hlissner/doom-emacs#2436
- ema2159/centaur-tabs#18
- ema2159/centaur-tabs#88
Some major modes (like rust-mode) may trigger
doom-highlight-non-default-indentation-h twice, causing whitespace-style
to be set to its default global value, which (by default) enables
whitespace-mode with all its features. This may overwhelm the
unsuspecting user, so we instead only tack on our modifications to
whitespace-style to its existing buffer-local value, rather than its
global value.
This update may potentially break your usage of add-hook! if you pass
the :local or :append properties to it. This is how they used to work:
(add-hook! :append 'some-mode-hook #'do-something)
Thsoe properties must now follow the hooks, e.g.
(add-hook! 'some-mode-hook :append #'do-something)
Other changes:
- Various add-hook calls have been renamed to add-hook! because I
incorrectly assumed `defun` always returned its definition's symbol,
when in fact, its return value is "undefined" (so sayeth the
documentation). This should fix#1597.
- This update adds the ability to add multiple functions to hooks
without a list:
(add-hook! 'some-mode-hook
#'do-something
#'do-something-else)
- The indentation logic has been changed so that consecutive function
symbols at indented at the same level as the first argument, but forms
are indent like a defun.
(add-hook! 'some-mode-hook
#'do-something
#'do-something-else)
(add-hook! 'some-mode-hook
(message "Hello"))
And ensure it runs as late as possible in after-change-major-mode-hook.
Hopefully to increase the probability of
doom-highlight-non-default-indentation-h detecting a user-enabled
whitespace-mode and bowing out in time.