Skip to content

Commit

Permalink
Add a customizable fallback icon for buffer transformer
Browse files Browse the repository at this point in the history
This way there's always some icon rendered

Related to #8
  • Loading branch information
asok committed Apr 20, 2019
1 parent ff469fe commit 86cb83d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion all-the-icons-ivy.el
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@
:type 'string
:group 'all-the-icons-ivy)

(defcustom all-the-icons-ivy-family-fallback-for-buffer
'all-the-icons-faicon
"Icon font family used as a fallback when no icon for buffer transformer can be found."
:type 'function
:options all-the-icons-font-families
:group 'all-the-icons-ivy)

(defcustom all-the-icons-ivy-name-fallback-for-buffer
"sticky-note-o"
"Icon font name used as a fallback when no icon for buffer transformer can be found."
:type 'string
:options all-the-icons-font-names
:group 'all-the-icons-ivy)

(defcustom all-the-icons-ivy-file-commands
'(counsel-find-file
Expand Down Expand Up @@ -92,7 +105,10 @@ If that fails look for an icon for the mode that the `major-mode' is derived fro
(format (concat "%s" all-the-icons-spacer "%s")
(propertize "\t" 'display (or
(all-the-icons-ivy--icon-for-mode mode)
(all-the-icons-ivy--icon-for-mode (get mode 'derived-mode-parent))))
(all-the-icons-ivy--icon-for-mode (get mode 'derived-mode-parent))
(funcall
all-the-icons-ivy-family-fallback-for-buffer
all-the-icons-ivy-name-fallback-for-buffer)))
(all-the-icons-ivy--buffer-propertize b s))))

(defun all-the-icons-ivy-icon-for-file (s)
Expand Down

0 comments on commit 86cb83d

Please sign in to comment.