Skip to content

Commit d0ebccd

Browse files
committed
feat(nerd-icons): add a generic function +nerd-icons-icon
1 parent ff385e0 commit d0ebccd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

modules/me-ui.el

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@
1414
:hook (minemacs-build-functions . nerd-icons-install-fonts)
1515
:config
1616
;; Show .m files as Matlab/Octave files (integral icon)
17-
(setcdr (assoc "m" nerd-icons-extension-icon-alist) '(nerd-icons-mdicon "nf-md-math_integral_box" :face nerd-icons-orange)))
17+
(setcdr (assoc "m" nerd-icons-extension-icon-alist) '(nerd-icons-mdicon "nf-md-math_integral_box" :face nerd-icons-orange))
18+
(defun +nerd-icons-icon (name &rest args)
19+
"Generic function to get icons by NAME, with ARGS."
20+
(if-let* ((variant (and (string-match "^nf-\\([[:alnum:]]+\\)-" name) (match-string 1 name)))
21+
(fn (intern (format "nerd-icons-%sicon" variant)))
22+
((fboundp fn)))
23+
(apply fn (cons name args))
24+
(error "Cannot detect the function which provides %S" name))))
1825

1926

2027
;; A megapack of themes for Emacs

0 commit comments

Comments
 (0)