Fix font icons that are missing fonts.

They need to match the xpm specifications
This commit is contained in:
Matthew L. Fidler 2016-05-31 19:08:44 -05:00
parent 878dee0dae
commit e380c293e5

View file

@ -1160,8 +1160,11 @@ ACTIVE if a flag for if the current window is active."
(nth 1 icon-spec)))
(put-text-property (point-min) (point-max)
'face face)
(put-text-property (point-min) (point-max)
'mode-icons-p icon-spec)
(if (mode-icons-supported-font-p (nth 1 icon-spec) (nth 2 icon-spec))
(put-text-property (point-min) (point-max)
'mode-icons-p icon-spec)
(put-text-property (point-min) (point-max)
'mode-icons-p (list (nth 0 icon-spec) xpm-name 'xpm-bw)))
(buffer-string))))))
(defun mode-icons-propertize-mode (mode icon-spec &optional face active)
@ -1183,6 +1186,7 @@ ACTIVE is a flag to tell if the current window is active."
'mode-icons-p icon-spec))
((mode-icons-supported-font-p (nth 1 icon-spec) (nth 2 icon-spec))
;; (propertize mode 'display (nth 1 icon-spec) 'mode-icons-p t)
;;(mode-icons--get-font " AI" '("\\` ?AI\\'" 61500 FontAwesome) face active)
(mode-icons--get-font mode icon-spec face active))
((and (stringp (nth 1 icon-spec)) (eq (nth 2 icon-spec) 'emoji))
(mode-icons--get-emoji mode icon-spec face active))
@ -1196,11 +1200,13 @@ ACTIVE is a flag to tell if the current window is active."
(concat "ext-" (nth 1 icon-spec))
'xpm-bw)))
(t (setq tmp (mode-icons-get-icon-display (nth 1 icon-spec) (nth 2 icon-spec) face active))
;; (when (string= (nth 0 icon-spec) "\\` ?AI\\'")
;; (message "plist: %s" tmp))
(cond
((and (plist-get tmp :xpm-bw) (plist-get tmp :icon))
(setq new-icon-spec (list (nth 0 icon-spec) (plist-get tmp :icon) 'xpm-bw)))
((and (eq (plist-get tmp :type) 'xpm) (plist-get tmp :icon))
(setq new-icon-spec (list (nth 0 icon-spec) (plist-get tmp :icon) 'xpm)))
((and (plist-get (cdr tmp) :xpm-bw) (plist-get (cdr tmp) :icon))
(setq new-icon-spec (list (nth 0 icon-spec) (plist-get (cdr tmp) :icon) 'xpm-bw)))
((and (eq (plist-get (cdr tmp) :type) 'xpm) (plist-get (cdr tmp) :icon))
(setq new-icon-spec (list (nth 0 icon-spec) (plist-get (cdr tmp) :icon) 'xpm)))
(t (setq new-icon-spec icon-spec)))
(propertize (format "%s" mode) 'display tmp
'mode-icons-p new-icon-spec))))))