Support multiple types of icons for color changes.

These functions now support the xpm-bw type
- mode-icons--generate-narrow
- mode-icons--read-only-status
- mode-icons--modified-construct
- mode-icons--mode-line-eol-desc

This is done by running `mode-icons-propertize-mode`
This commit is contained in:
Matthew Fidler 2016-03-31 00:07:13 -05:00
parent eabe9b05ca
commit b014d746ea

View file

@ -342,17 +342,21 @@ the icon.
FACE should be the face for rendering black and white xpm icons
specified by type 'xpm-bw."
(or (gethash (list icon type (or face 'mode-line)) mode-icons-get-icon-display)
(puthash (list icon type (or face 'mode-line))
(let ((face (or face
(and (mode-icons--selected-window-active)
'mode-line)
'mode-line-inactive)))
(or (gethash (list icon type face) mode-icons-get-icon-display)
(puthash (list icon type face)
(let ((icon-path (mode-icons-get-icon-file
(concat icon "." (or (and (eq type 'xpm-bw) "xpm")
(symbol-name type))))))
(if (eq type 'xpm-bw)
(create-image (mode-icons-get-icon-display-xpm-bw-face icon-path face)
'xpm t :ascent 'center
:face (or face 'mode-line))
:face face)
`(image :type ,(or (and (eq type 'jpg) 'jpeg) type) :file ,icon-path :ascent center)))
mode-icons-get-icon-display)))
mode-icons-get-icon-display))))
(defcustom mode-icons-minor-mode-base-text-properties
'('help-echo nil
@ -525,7 +529,12 @@ FACE is the face to match when a xpm-bw image is used."
(nth 1 icon-spec)))
(put-text-property (point-min) (point-max) 'mode-icons-p icon-spec)
(buffer-string)))
(t (propertize (format "%s" mode) 'display (mode-icons-get-icon-display (nth 1 icon-spec) (nth 2 icon-spec) face)
(t (propertize (format "%s" mode) 'display
(mode-icons-get-icon-display (nth 1 icon-spec) (nth 2 icon-spec)
(or face
(and (mode-icons--selected-window-active)
'mode-line)
'mode-line-inactive))
'mode-icons-p icon-spec)))))
(defvar mode-icons-get-icon-spec (make-hash-table :test 'equal)