mode-icons-get-icon-display works for all types.

Fix Issue #22
This commit is contained in:
Matthew Fidler 2016-04-06 08:17:02 -05:00
parent f030c261c5
commit 5644871fa3

View file

@ -1087,6 +1087,7 @@ the actual font."
MODE should be a string, the name of the mode to propertize. MODE should be a string, the name of the mode to propertize.
ICON-SPEC should be a specification from `mode-icons'. ICON-SPEC should be a specification from `mode-icons'.
FACE is the face to match when a xpm-bw image is used." FACE is the face to match when a xpm-bw image is used."
(let (tmp)
(mode-icons-save-buffer-state ;; Otherwise may cause issues with trasient mark mode (mode-icons-save-buffer-state ;; Otherwise may cause issues with trasient mark mode
(cond (cond
((and (stringp mode) (get-text-property 0 'mode-icons-p mode)) ((and (stringp mode) (get-text-property 0 'mode-icons-p mode))
@ -1096,10 +1097,15 @@ FACE is the face to match when a xpm-bw image is used."
((and (stringp (nth 1 icon-spec)) (not (nth 2 icon-spec))) ((and (stringp (nth 1 icon-spec)) (not (nth 2 icon-spec)))
(propertize (nth 1 icon-spec) 'display (nth 1 icon-spec) (propertize (nth 1 icon-spec) 'display (nth 1 icon-spec)
'mode-icons-p icon-spec)) 'mode-icons-p icon-spec))
((mode-icons-supported-font-p (nth 1 icon-spec) (nth 2 icon-spec)) ((or (mode-icons-supported-font-p (nth 1 icon-spec) (nth 2 icon-spec))
;; (propertize mode 'display (nth 1 icon-spec) 'mode-icons-p t) (and (image-type-available-p 'xpm)
(mode-icons--get-font-xpm-file icon-spec)
(file-exists-p (mode-icons--get-font-xpm-file icon-spec))))
(mode-icons--get-font mode icon-spec face)) (mode-icons--get-font mode icon-spec face))
((and (stringp (nth 1 icon-spec)) (eq (nth 2 icon-spec) 'emoji)) ((and (eq (nth 2 icon-spec) 'emoji)
(or (and (image-type-available-p 'png) (featurep 'emojify))
(and (image-type-available-p 'xpm)
(file-exists-p (mode-icons--get-emoji-xpm-file icon-spec)))))
(mode-icons--get-emoji mode icon-spec face)) (mode-icons--get-emoji mode icon-spec face))
((and (stringp (nth 1 icon-spec)) (eq (nth 2 icon-spec) 'png)) ((and (stringp (nth 1 icon-spec)) (eq (nth 2 icon-spec) 'png))
(mode-icons--get-png mode icon-spec face)) (mode-icons--get-png mode icon-spec face))
@ -1120,7 +1126,7 @@ FACE is the face to match when a xpm-bw image is used."
(and (mode-icons--selected-window-active) (and (mode-icons--selected-window-active)
'mode-line) 'mode-line)
'mode-line-inactive)) 'mode-line-inactive))
'mode-icons-p icon-spec))))) 'mode-icons-p icon-spec))))))
(defvar mode-icons-get-icon-spec (make-hash-table :test 'equal) (defvar mode-icons-get-icon-spec (make-hash-table :test 'equal)
"Hash table of icon-specifications.") "Hash table of icon-specifications.")