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