about summary refs log tree commit diff stats
path: root/lisp/acdw-frame.el
blob: 753fd143318ff1a4742d15f0d7cef04335f7d624 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
;;; acdw-frame.el -*- lexical-binding: t; coding: utf-8-unix -*-

;;; Fonts

(defun acdw/set-first-face-attribute (face font-list)
  "Set FACE to the first font found in FONT-LIST.
FONT-LIST is a list of `font-spec' plists to be passed to
`set-face-attribute'."
  (cond
   ((or (null window-system)
        (null font-list))
    nil)
   ((x-list-fonts (or (plist-get (car font-list) :font)
                      (plist-get (car font-list) :family)))
    (apply #'set-face-attribute face nil (car font-list)))
   (t (acdw/set-first-face-attribute face (cdr font-list)))))

(defun acdw/set-emoji-fonts (&rest emoji-fonts)
  "Add all installed EMOJI-FONTS to the symbol fontset."
  (let ((ffl (font-family-list)))
    (dolist (font emoji-fonts)
      (when (member font ffl)
        (set-fontset-font t 'symbol
                          (font-spec :family font) nil 'append)))))

;;; Fringes

(defun acdw/set-fringes (bitmap-list)
  "Apply multiple fringes at once.
BITMAP-LIST is a list of arglists passed directly to
`define-fringe-bitmap', which see."
  (dolist (bitmap bitmap-list)
    (apply #'define-fringe-bitmap bitmap))
  (redraw-frame))

(provide 'acdw-frame)