summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2021-05-19 17:07:36 -0500
committerCase Duckworth2021-05-19 17:07:36 -0500
commit19e1ce4c6a14a303ef4312c750270a50f99ba755 (patch)
treee59b1fb21ed1f3262883e7c662b1938340e02b7e /lisp
parentChange definition of `acdw-org/count-words' (diff)
parentConfigure shell-command (diff)
downloademacs-19e1ce4c6a14a303ef4312c750270a50f99ba755.tar.gz
emacs-19e1ce4c6a14a303ef4312c750270a50f99ba755.zip
Merge branch 'main' of https://tildegit.org/acdw/emacs
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw-fonts.el45
1 files changed, 45 insertions, 0 deletions
diff --git a/lisp/acdw-fonts.el b/lisp/acdw-fonts.el index 6c0cb8d..1b73af7 100644 --- a/lisp/acdw-fonts.el +++ b/lisp/acdw-fonts.el
@@ -127,5 +127,50 @@ This is for emoji fonts."
127 (set-fontset-font t 'symbol 127 (set-fontset-font t 'symbol
128 (font-spec :family font) nil 'append))))) 128 (font-spec :family font) nil 'append)))))
129 129
130
131;;; Variable-pitch
132;; from https://github.com/turbana/emacs-config#variable-pitch
133
134(defcustom acdw-fonts/fixed-pitch-faces '(linum
135 org-block
136 org-block-begin-line
137 org-block-end-line
138 org-checkbox
139 org-code
140 org-date
141 org-document-info-keyword
142 org-hide
143 org-indent
144 org-link
145 org-meta-line
146 org-special-keyword
147 org-table
148 whitespace-space)
149 "Faces to keep fixed-pitch in `acdw/variable-pitch-mode'."
150 :type 'sexp
151 :group 'faces)
152
153(defun acdw-fonts//variable-pitch-add-inherit (attrs parent)
154 "Add `:inherit PARENT' to ATTRS unless already present.
155Handles cases where `:inherit' is already specified."
156 (let ((current-parent (plist-get attrs :inherit)))
157 (unless (or (eq parent current-parent)
158 (and (listp current-parent)
159 (member parent current-parent)))
160 (plist-put attrs :inherit (if current-parent
161 (list current-parent parent)
162 parent)))))
163
164(defun acdw-fonts/adapt-variable-pitch ()
165 "Adapt `variable-pitch-mode' to keep some fonts fixed-pitch."
166 (when variable-pitch-mode
167 (mapc (lambda (face)
168 (when (facep face)
169 (apply #'set-face-attribute
170 face nil (acdw-fonts//variable-pitch-add-inherit
171 (face-attr-construct face)
172 'fixed-pitch))))
173 acdw-fonts/fixed-pitch-faces)))
174
130(provide 'acdw-fonts) 175(provide 'acdw-fonts)
131;;; acdw-fonts.el ends here 176;;; acdw-fonts.el ends here