emacs: refactor faces configuration

This commit is contained in:
Jeremy Baxter 2024-07-19 10:05:32 +12:00
parent 0b142907e6
commit 6d4157357c

View file

@ -30,6 +30,20 @@
"Reindent the current buffer." "Reindent the current buffer."
(interactive) (interactive)
(indent-region (point-min) (point-max))) (indent-region (point-min) (point-max)))
(defun set-face-attributes (list-of-lists)
"For each sublist of LIST-OF-LISTS, apply the attributes specified in
the cdr to the face specified by the car.
That is, the call:
(set-face-attributes '((font-lock-comment-face :slant italic)))
will set the `:slant' attribute of `font-lock-comment-face' to the
value `italic'."
(mapc #'(lambda (l)
(apply #'set-face-attribute
`(,(car l) t ,@(cdr l))))
list-of-lists))
;; other key binds ;; other key binds
(global-set-key (kbd "C-c e r") 'reindent-buffer) (global-set-key (kbd "C-c e r") 'reindent-buffer)
@ -200,20 +214,24 @@
(package-install 'magit) (package-install 'magit)
(global-set-key (kbd "C-c b") 'magit-blame) (global-set-key (kbd "C-c b") 'magit-blame)
;; fonts ;; faces
(let (let
((font-fixed "Roboto Mono") ((fixedpt "Roboto Mono")
(font-varpt "Roboto")) ( varpt "Roboto"))
(add-to-list 'default-frame-alist '(font . "Roboto Mono")) (add-to-list 'default-frame-alist (cons 'font fixedpt))
(set-face-attribute 'default t :height 140) (set-face-attributes
(set-face-attribute 'fixed-pitch t :family font-fixed) '((default :height 140)
(set-face-attribute 'variable-pitch t :family font-varpt) (fixed-pitch :family fixedpt)
(set-face-attribute 'fixed-pitch-serif t (variable-pitch :family varpt)
:family font-fixed (fixed-pitch :family fixedpt :weight regular)
:weight 'regular)) (font-lock-comment-face :slant italic)
;; make comments italic (font-lock-keyword-face :slant italic)
(set-face-attribute 'font-lock-comment-face t :slant 'italic) (help-key-binding
(set-face-attribute 'font-lock-keyword-face t :slant 'italic) :family fixedpt
:background "#181825"
:foreground "#89b4fa"
:box (:line-width (-1 . -1) :color "#11111b" :style nil))
(anzu-mode-line :foreground "#89b4fa"))))
;; custom ;; custom
(setq custom-file "~/.emacs.d/custom.el") (setq custom-file "~/.emacs.d/custom.el")