fix: blank frame on can't-find-font error during startup

Due to our inhibit-redisplay hack, a missing font could lead to a blank
Emacs after startup. This change fixes that so that not only is an error
emitted when Emacs can't find your font, but the error will be a little
more readable.

This is a stopgap solution until I finish a better one I'm preparing for
v3.

Fix: #7055
This commit is contained in:
Henrik Lissner 2024-02-20 05:30:13 -05:00 committed by Yann Esposito (Yogsototh)
parent a103cb3a2d
commit 344881cbf5
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646

View file

@ -524,6 +524,7 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
(fixed-pitch . ,doom-font)
(fixed-pitch-serif . ,doom-serif-font)
(variable-pitch . ,doom-variable-pitch-font)))
(condition-case e
(when-let* ((face (car map))
(font (cdr map)))
(dolist (frame (frame-list))
@ -535,7 +536,12 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
;; Don't save to `customized-face' so it's omitted from `custom-file'
;;(put face 'customized-face new-specs)
(custom-push-theme 'theme-face face 'user 'set new-specs)
(put face 'face-modified nil))))
(put face 'face-modified nil)))
('error
(ignore-errors (doom--reset-inhibited-vars-h))
(if (string-prefix-p "Font not available" (error-message-string e))
(signal 'doom-font-error (list (font-get (cdr map) :family)))
(signal (car e) (cdr e))))))
(when (fboundp 'set-fontset-font)
(let* ((fn (doom-rpartial #'member (font-family-list)))
(symbol-font (or doom-symbol-font