From f62a1f640b75b8bde8755663196f178d747e0007 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 19 Mar 2024 20:33:39 -0400 Subject: [PATCH] refactor: inline doom--make-font-specs This function isn't (and won't be) used anywhere else. No reason for it to be its own function. --- lisp/doom-ui.el | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/lisp/doom-ui.el b/lisp/doom-ui.el index 95d5b92ce..64db32afd 100644 --- a/lisp/doom-ui.el +++ b/lisp/doom-ui.el @@ -498,23 +498,6 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original (cons 'custom-theme-directory (delq 'custom-theme-directory custom-theme-load-path))) -(defun doom--make-font-specs (face font frame) - (let* ((base-specs (cadr (assq 'user (get face 'theme-face)))) - (base-specs (or base-specs '((t nil)))) - (attrs '(:family :foundry :slant :weight :height :width)) - (new-specs nil)) - (dolist (spec base-specs) - ;; Each SPEC has the form (DISPLAY ATTRIBUTE-PLIST) - (let ((display (car spec)) - (plist (copy-tree (nth 1 spec)))) - ;; Alter only DISPLAY conditions matching this frame. - (when (or (memq display '(t default)) - (face-spec-set-match-display display frame)) - (dolist (attr attrs) - (setq plist (plist-put plist attr (face-attribute face attr))))) - (push (list display plist) new-specs))) - (nreverse new-specs))) - (defun doom-init-fonts-h (&optional _reload) "Loads `doom-font', `doom-serif-font', and `doom-variable-pitch-font'." (let ((this-frame (selected-frame))) @@ -530,11 +513,24 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original (set-face-attribute face frame :width 'normal :weight 'normal :slant 'normal :font font))) - (let ((new-specs (doom--make-font-specs face font this-frame))) - ;; 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))) + (custom-push-theme + 'theme-face face 'user 'set + (let* ((base-specs (cadr (assq 'user (get face 'theme-face)))) + (base-specs (or base-specs '((t nil)))) + (attrs '(:family :foundry :slant :weight :height :width)) + (new-specs nil)) + (dolist (spec base-specs) + ;; Each SPEC has the form (DISPLAY ATTRIBUTE-PLIST) + (let ((display (car spec)) + (plist (copy-tree (nth 1 spec)))) + ;; Alter only DISPLAY conditions matching this frame. + (when (or (memq display '(t default)) + (face-spec-set-match-display display this-frame)) + (dolist (attr attrs) + (setq plist (plist-put plist attr (face-attribute face attr))))) + (push (list display plist) new-specs))) + (nreverse new-specs))) + (put face 'face-modified nil)) ('error (ignore-errors (doom--reset-inhibited-vars-h)) (if (string-prefix-p "Font not available" (error-message-string e))