aboutsummaryrefslogtreecommitdiffstats
path: root/mode-icons.el
diff options
context:
space:
mode:
authorGravatar Matthew L. Fidler2016-02-09 08:05:13 -0600
committerGravatar Matthew L. Fidler2016-02-09 08:05:13 -0600
commitba648eb5b32f361cb7784a7d0ff4345b2f092515 (patch)
tree5f09840a8968fd2b097ff5298af544acfd283ce2 /mode-icons.el
parent5be52add14d1fe128a4a7187cf46b0da6da37750 (diff)
downloadmode-icons-ba648eb5b32f361cb7784a7d0ff4345b2f092515.tar.gz
mode-icons-ba648eb5b32f361cb7784a7d0ff4345b2f092515.zip
Add mode-icons-p property
Diffstat (limited to 'mode-icons.el')
-rw-r--r--mode-icons.el16
1 files changed, 11 insertions, 5 deletions
diff --git a/mode-icons.el b/mode-icons.el
index 57be858..97a6f72 100644
--- a/mode-icons.el
+++ b/mode-icons.el
@@ -141,16 +141,22 @@ the icon."
MODE should be a string, the name of the mode to propertize.
ICON-SPEC should be a specification from `mode-icons'."
(cond
- ((not (nth 1 icon-spec)) "")
+ ((get-text-property 0 'mode-icons-p mode)
+ mode)
+ ((not (nth 1 icon-spec))
+ "")
((and mode-icons-octicons-font (stringp (nth 1 icon-spec)) (eq (nth 2 icon-spec) 'octicons))
(propertize mode 'display (nth 1 icon-spec)
- 'font 'mode-icons-octicons-font))
+ 'font 'mode-icons-octicons-font
+ 'mode-icons-p t))
((and (stringp (nth 1 icon-spec)) (not (nth 2 icon-spec)))
- (propertize mode 'display (mode-icons-get-icon-display (nth 1 icon-spec) (nth 2 icon-spec))))
- (t (propertize mode 'display (mode-icons-get-icon-display (nth 1 icon-spec) (nth 2 icon-spec))))))
+ (propertize mode 'display (mode-icons-get-icon-display (nth 1 icon-spec) (nth 2 icon-spec))
+ 'mode-icons-p t))
+ (t (propertize mode 'display (mode-icons-get-icon-display (nth 1 icon-spec) (nth 2 icon-spec))
+ 'mode-icons-p t))))
(defun mode-icons-get-icon-spec (mode)
- "Get icon spec based on regular expression."
+ "Get icon spec for MODE based on regular expression."
(catch 'found-mode
(dolist (item mode-icons)
(when (string-match-p (car item) mode)