Skip to content

Commit

Permalink
Ovewrite the icons properties by passing the arg overwrites argument
Browse files Browse the repository at this point in the history
The default overwrite is to set `:height` to `1.0`.

Related to #8
  • Loading branch information
asok committed May 4, 2019
1 parent b768b83 commit 937ca70
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions all-the-icons-ivy.el
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@
:options all-the-icons-font-names
:group 'all-the-icons-ivy)

(defcustom all-the-icons-ivy-icon-args
(list :height 1.0)
"The arg overwrites plist passed to `all-the-icons' icon functions."
:type 'list
:group 'all-the-icons-ivy)

(defcustom all-the-icons-ivy-file-commands
'(counsel-find-file
counsel-file-jump
Expand All @@ -93,7 +99,7 @@

(defun all-the-icons-ivy--icon-for-mode (mode)
"Apply `all-the-icons-for-mode' on MODE but either return an icon or nil."
(let ((icon (all-the-icons-icon-for-mode mode)))
(let ((icon (apply 'all-the-icons-icon-for-mode (append (list mode) all-the-icons-ivy-icon-args))))
(unless (symbolp icon)
icon)))

Expand All @@ -106,9 +112,11 @@ If that fails look for an icon for the mode that the `major-mode' is derived fro
(propertize "\t" 'display (or
(all-the-icons-ivy--icon-for-mode mode)
(all-the-icons-ivy--icon-for-mode (get mode 'derived-mode-parent))
(funcall
(apply
all-the-icons-ivy-family-fallback-for-buffer
all-the-icons-ivy-name-fallback-for-buffer)))
(append
(list all-the-icons-ivy-name-fallback-for-buffer)
all-the-icons-ivy-icon-args))))
(all-the-icons-ivy--buffer-propertize b s))))

(defun all-the-icons-ivy-icon-for-file (s)
Expand All @@ -117,8 +125,13 @@ Return the octicon for directory if S is a directory.
Otherwise fallback to calling `all-the-icons-icon-for-file'."
(cond
((string-match-p "\\/$" s)
(all-the-icons-octicon "file-directory" :face 'all-the-icons-ivy-dir-face))
(t (all-the-icons-icon-for-file s))))
(apply 'all-the-icons-octicon
(append
(list "file-directory")
all-the-icons-ivy-icon-args
(list :face 'all-the-icons-ivy-dir-face))))
(t
(apply 'all-the-icons-icon-for-file (append (list s) all-the-icons-ivy-icon-args)))))

(defun all-the-icons-ivy-file-transformer (s)
"Return a candidate string for filename S preceded by an icon."
Expand Down

0 comments on commit 937ca70

Please sign in to comment.