Get rid of my custom theme/font stuff in favor of customize
This commit is contained in:
parent
5e81e7aea4
commit
0acbe97a23
@ -826,85 +826,11 @@ Load up some tasty themes:
|
||||
(use-package solarized-theme)
|
||||
#+END_SRC
|
||||
|
||||
How to disable all applied custom themes:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun disable-all-themes ()
|
||||
(interactive)
|
||||
(mapcar #'disable-theme custom-enabled-themes))
|
||||
#+END_SRC
|
||||
|
||||
A function to load a font, including overriding any theme settings for org-mode headers:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun jdormit/get-font-alist ()
|
||||
(let ((font-alist (get-persisted-var 'jdormit/font)))
|
||||
(if font-alist
|
||||
font-alist
|
||||
(list))))
|
||||
|
||||
(defun jdormit/load-font (face font height)
|
||||
(interactive
|
||||
(list
|
||||
(intern (completing-read "Change face: " (face-list)))
|
||||
(completing-read "Load font: " (font-family-list))
|
||||
(read-minibuffer "Font height: " "120")))
|
||||
(when (display-graphic-p)
|
||||
(if (not (number-or-marker-p height))
|
||||
(error "Height must be a number.")
|
||||
(if (member font (font-family-list))
|
||||
(if (member face (face-list))
|
||||
(let ((font-alist
|
||||
(assq-delete-all face (jdormit/get-font-alist))))
|
||||
(progn
|
||||
(set-face-attribute face nil :family font :height height)
|
||||
(persist-variable
|
||||
'jdormit/font
|
||||
(cons `(,face (,font ,height)) font-alist))))
|
||||
(error "Face %s not found." (symbol-name face)))
|
||||
(error "Font %s not found." font)))))
|
||||
|
||||
(defun jdormit/load-persisted-fonts ()
|
||||
(let ((fonts (jdormit/get-font-alist)))
|
||||
(dolist (font fonts)
|
||||
(jdormit/load-font (car font) (car (cadr font)) (cadr (cadr font))))))
|
||||
#+END_SRC
|
||||
|
||||
A function to load a theme then override font settings:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun jdormit/load-theme (theme)
|
||||
(interactive
|
||||
(list (intern (completing-read "Load custom theme: "
|
||||
(mapcar 'symbol-name
|
||||
(custom-available-themes))))))
|
||||
(disable-all-themes)
|
||||
(load-theme theme t)
|
||||
(jdormit/load-persisted-fonts)
|
||||
(persist-variable 'jdormit/theme theme))
|
||||
#+END_SRC
|
||||
|
||||
UI-related keybindings:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(jdormit/define-prefix "u" "UI")
|
||||
(leader-def-key "ut" 'jdormit/load-theme)
|
||||
(leader-def-key "uf" 'jdormit/load-font)
|
||||
#+END_SRC
|
||||
|
||||
Some defaults:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(let ((default (assoc 'default (jdormit/get-font-alist)))
|
||||
(fixed-pitch (assoc 'fixed-pitch (jdormit/get-font-alist)))
|
||||
(variable-pitch (assoc 'variable-pitch (jdormit/get-font-alist)))
|
||||
(theme (get-persisted-var 'jdormit/theme)))
|
||||
(unless default (jdormit/load-font 'default "Courier" 120))
|
||||
(unless fixed-pitch (jdormit/load-font 'fixed-pitch "Courier" 115))
|
||||
(unless variable-pitch (jdormit/load-font 'variable-pitch "Palatino" 120))
|
||||
(unless theme (jdormit/load-theme 'poet)))
|
||||
#+END_SRC
|
||||
|
||||
Load up previously saved theme and font:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(when-let ((theme (get-persisted-var 'jdormit/theme)))
|
||||
(jdormit/load-theme theme))
|
||||
(jdormit/load-persisted-fonts)
|
||||
(leader-def-key "ut" #'customize-themes)
|
||||
(leader-def-key "uf" #'customize-face)
|
||||
#+END_SRC
|
||||
|
||||
* Frame parameters
|
||||
|
Loading…
Reference in New Issue
Block a user