diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/acdw-fonts.el | 45 |
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. | ||
155 | Handles 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 |