Minor refactor of doom|init-fonts

Prefer native functions over macros, and conform to new convention of
naming condition-case error variables "e".

No, not the meme.
This commit is contained in:
Henrik Lissner 2018-07-03 03:38:18 +02:00
parent 65d2b01333
commit b42dd5c1db
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -551,7 +551,7 @@ frame's window-system, the theme will be reloaded.")
(defun doom|init-fonts ()
"Initialize fonts."
(condition-case-unless-debug ex
(condition-case e
(custom-set-faces
(when (fontp doom-font)
(let ((xlfd (font-xlfd-name doom-font)))
@ -564,14 +564,14 @@ frame's window-system, the theme will be reloaded.")
(setq use-default-font-for-symbols nil)
(set-fontset-font t 'unicode doom-unicode-font nil)
nil))
('error
(if (string-prefix-p "Font not available: " (error-message-string ex))
((debug error)
(if (string-prefix-p "Font not available: " (error-message-string e))
(lwarn 'doom-ui :warning
"Could not find the '%s' font on your system, falling back to system font"
(font-get (caddr ex) :family))
(font-get (caddr e) :family))
(lwarn 'doom-ui :error
"Unexpected error while initializing fonts: %s"
(error-message-string ex))))))
(error-message-string e))))))
(defun doom|init-theme ()
"Set the theme and load the font, in that order."