Skip to content

Commit

Permalink
perf: Direct icon
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed May 18, 2024
1 parent 9803b42 commit 47adaff
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion jcs-modeline.el
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,15 @@ Position argument ARG0."
:type 'boolean
:group 'jcs-modeline)

(defun jcs-modeline--nerd-icons-icon-for-buffer ()
"Return icon for buffer."
(or (ignore-errors (nerd-icons-icon-for-file (file-name-nondirectory (buffer-file-name))))
(ignore-errors (nerd-icons-icon-for-mode major-mode))))

(defun jcs-modeline--render-modes ()
"Render line modes."
(let* ((icon (and jcs-modeline-show-mode-icons
(when-let* ((icon (nerd-icons-icon-for-buffer))
(when-let* ((icon (jcs-modeline--nerd-icons-icon-for-buffer))
(icon (if (or (null icon) (symbolp icon))
(nerd-icons-faicon "nf-fa-file_o")
icon))
Expand Down

0 comments on commit 47adaff

Please sign in to comment.