mirror of
https://github.com/ryuslash/mode-icons.git
synced 2024-11-22 01:50:28 +01:00
parent
f030c261c5
commit
5644871fa3
1 changed files with 40 additions and 34 deletions
|
@ -1087,40 +1087,46 @@ 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."
|
||||||
(mode-icons-save-buffer-state ;; Otherwise may cause issues with trasient mark mode
|
(let (tmp)
|
||||||
(cond
|
(mode-icons-save-buffer-state ;; Otherwise may cause issues with trasient mark mode
|
||||||
((and (stringp mode) (get-text-property 0 'mode-icons-p mode))
|
(cond
|
||||||
mode)
|
((and (stringp mode) (get-text-property 0 'mode-icons-p mode))
|
||||||
((not (nth 1 icon-spec))
|
mode)
|
||||||
"")
|
((not (nth 1 icon-spec))
|
||||||
((and (stringp (nth 1 icon-spec)) (not (nth 2 icon-spec)))
|
"")
|
||||||
(propertize (nth 1 icon-spec) 'display (nth 1 icon-spec)
|
((and (stringp (nth 1 icon-spec)) (not (nth 2 icon-spec)))
|
||||||
'mode-icons-p icon-spec))
|
(propertize (nth 1 icon-spec) 'display (nth 1 icon-spec)
|
||||||
((mode-icons-supported-font-p (nth 1 icon-spec) (nth 2 icon-spec))
|
'mode-icons-p icon-spec))
|
||||||
;; (propertize mode 'display (nth 1 icon-spec) 'mode-icons-p t)
|
((or (mode-icons-supported-font-p (nth 1 icon-spec) (nth 2 icon-spec))
|
||||||
(mode-icons--get-font mode icon-spec face))
|
(and (image-type-available-p 'xpm)
|
||||||
((and (stringp (nth 1 icon-spec)) (eq (nth 2 icon-spec) 'emoji))
|
(mode-icons--get-font-xpm-file icon-spec)
|
||||||
(mode-icons--get-emoji mode icon-spec face))
|
(file-exists-p (mode-icons--get-font-xpm-file icon-spec))))
|
||||||
((and (stringp (nth 1 icon-spec)) (eq (nth 2 icon-spec) 'png))
|
(mode-icons--get-font mode icon-spec face))
|
||||||
(mode-icons--get-png mode icon-spec face))
|
((and (eq (nth 2 icon-spec) 'emoji)
|
||||||
((and (stringp (nth 1 icon-spec)) (eq (nth 2 icon-spec) 'ext))
|
(or (and (image-type-available-p 'png) (featurep 'emojify))
|
||||||
(propertize (format "%s" mode) 'display
|
(and (image-type-available-p 'xpm)
|
||||||
(mode-icons-get-icon-display
|
(file-exists-p (mode-icons--get-emoji-xpm-file icon-spec)))))
|
||||||
(concat "ext-" (nth 1 icon-spec)) 'xpm-bw
|
(mode-icons--get-emoji mode icon-spec face))
|
||||||
(or face
|
((and (stringp (nth 1 icon-spec)) (eq (nth 2 icon-spec) 'png))
|
||||||
(and (mode-icons--selected-window-active)
|
(mode-icons--get-png mode icon-spec face))
|
||||||
'mode-line)
|
((and (stringp (nth 1 icon-spec)) (eq (nth 2 icon-spec) 'ext))
|
||||||
'mode-line-inactive))
|
(propertize (format "%s" mode) 'display
|
||||||
'mode-icons-p (list (nth 0 icon-spec)
|
(mode-icons-get-icon-display
|
||||||
(concat "ext-" (nth 1 icon-spec))
|
(concat "ext-" (nth 1 icon-spec)) 'xpm-bw
|
||||||
'xpm-bw)))
|
(or face
|
||||||
(t (propertize (format "%s" mode) 'display
|
(and (mode-icons--selected-window-active)
|
||||||
(mode-icons-get-icon-display (nth 1 icon-spec) (nth 2 icon-spec)
|
'mode-line)
|
||||||
(or face
|
'mode-line-inactive))
|
||||||
(and (mode-icons--selected-window-active)
|
'mode-icons-p (list (nth 0 icon-spec)
|
||||||
'mode-line)
|
(concat "ext-" (nth 1 icon-spec))
|
||||||
'mode-line-inactive))
|
'xpm-bw)))
|
||||||
'mode-icons-p icon-spec)))))
|
(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)
|
(defvar mode-icons-get-icon-spec (make-hash-table :test 'equal)
|
||||||
"Hash table of icon-specifications.")
|
"Hash table of icon-specifications.")
|
||||||
|
|
Loading…
Reference in a new issue