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.
This commit is contained in:
parent
1d99d1f191
commit
6b55c6adc6
1 changed files with 18 additions and 22 deletions
|
@ -498,23 +498,6 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
||||||
(cons 'custom-theme-directory
|
(cons 'custom-theme-directory
|
||||||
(delq 'custom-theme-directory custom-theme-load-path)))
|
(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)
|
(defun doom-init-fonts-h (&optional _reload)
|
||||||
"Loads `doom-font', `doom-serif-font', and `doom-variable-pitch-font'."
|
"Loads `doom-font', `doom-serif-font', and `doom-variable-pitch-font'."
|
||||||
(let ((this-frame (selected-frame)))
|
(let ((this-frame (selected-frame)))
|
||||||
|
@ -530,11 +513,24 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
||||||
(set-face-attribute face frame
|
(set-face-attribute face frame
|
||||||
:width 'normal :weight 'normal
|
:width 'normal :weight 'normal
|
||||||
:slant 'normal :font font)))
|
:slant 'normal :font font)))
|
||||||
(let ((new-specs (doom--make-font-specs face font this-frame)))
|
(custom-push-theme
|
||||||
;; Don't save to `customized-face' so it's omitted from `custom-file'
|
'theme-face face 'user 'set
|
||||||
;;(put face 'customized-face new-specs)
|
(let* ((base-specs (cadr (assq 'user (get face 'theme-face))))
|
||||||
(custom-push-theme 'theme-face face 'user 'set new-specs)
|
(base-specs (or base-specs '((t nil))))
|
||||||
(put face 'face-modified 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
|
('error
|
||||||
(ignore-errors (doom--reset-inhibited-vars-h))
|
(ignore-errors (doom--reset-inhibited-vars-h))
|
||||||
(if (string-prefix-p "Font not available" (error-message-string e))
|
(if (string-prefix-p "Font not available" (error-message-string e))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue