Emacs 27 introduced a bunch of `window-*-change-functions` hooks,
including `window-selection-change-functions` and
`window-buffer-change-functions`, which handles 98% of the use case for
Doom's `doom-switch-{buffer,window,frame}-hook` hooks, so I've rewritten
them to use them under the hood, which amounts to simpler code and fewer
hacks.
Use the new server-after-make-frame-hook, introduced in Emacs 27.1, to
clean up how we initialize fonts, themes, and the UI in general.
This may indirectly fix font issues in daemon sessions.
Emacs 27.x has been the stable version of Emacs for nearly a year, and
introduces a litany of bugfixes, performance, and quality-of-life
improvements that significantly reduce Doom's maintenance burden (like
XDG support, early-init.el, image manipulation without imagemagick, a
native JSON library, harfbuzz support, pdumper, and others).
With so many big changes on Doom's horizon, I like having one less (big)
thing to worry about.
Also reverts bb677cf7a (#5232) as it is no longer needed.
Setting a face's `:font` attribute implicitly sets a host of other faces
attributes (:family, :foundry, :width, :weight, :height, and :slant),
which is problematic in places where these faces are used in tandem with
other faces, like how EWW renders bold elements with both
variable-pitch+bold faces, with the expectation that their attributes
would cascade properly, but not so if variable-pitch sets :weight or
:slant.
custom-theme-set-faces! depends on doom-theme's previous-theme property
being non-nil to determine if the theme has been set (and if so, apply
its changes immediately), but at startup custom-enabled-themes is empty,
so it was never non-nil.
Fixes#5009Fixes#5000
Trying to get 'doom to behave like 'user is too much trouble and causes
too many problems. The magic around 'user is too deeply woven into
custom.el. The whole custom.el fiasco needs to be dealt with another
way.
Fixes#5000Fixes#5009
'doom is a pseudo theme used to store internal faces and variables, and
must have the highest precedence (like the 'user theme, but without the
risk of being written to custom-file).
doom-unicode-font, doom-variable-pitch-font, and the fontset settings
were loaded in the wrong order (before the theme, but should be after).
This means the psuedo 'doom' theme that stores these settings are being
loaded too early.
+ Adds doom-emoji-fallback-font-families
+ Adds doom-symbol-fallback-font-families
+ Gives doom-unicode-font higher precedence (and sets it to nil by
default, since Emacs defaults to symbola already).
+ Store custom face settings in psuedo theme, rather than crowding the
user theme (which may be immortalized to custom-file, which we want to
avoid).
+ Now, after-setting-font-hook is guaranteed to fire after *all* fonts
are set, giving you a more reliable interface to add your own
font(set) modifications.
More testing is needed to ensure the patched fonts our ligatures modules
don't conflict with this change.
Produces more helpful (and harder-to-miss) error messages when a hook
emits an error. Also advises run-hook when doom-debug-mode is active, so
errors in hooks (generally, major mode hooks) don't quietly go
unnoticed.
In older versions of Emacs (26.3 and below), the minibuffer would
replace the whole minibuffer's contents just to display error messages.
This was very frustrating for mundane errors, like the "text is
read-only" error you get when you press backspace at BOL.
Later versions of Emacs now display errors at the end of the minibuffer,
so this hack will no longer be needed when we drop 26.x support later
this year.
+ Some snippets libraries assume this instead of the advise, causing
errors.
+ Advising a C function may have implications when its uses are
natively compiled.