Function: nerd-icons-cache
nerd-icons-cache is a natively compiled function defined in
nerd-icons.el.
Signature
(nerd-icons-cache FUNC)
Documentation
Set a cache for FUNC. Does not work on interactive functions.
Source Code
;; Defined in /nix/store/yazcqi510kxs7jygyiirgf8qyg348f6p-emacs-packages-deps/share/emacs/site-lisp/elpa/nerd-icons-20260823.17/nerd-icons.el
(defun nerd-icons-cache (func)
"Set a cache for FUNC. Does not work on interactive functions."
(unless (get func 'nerd-icons--cached)
(let ((cache (make-hash-table :test #'equal
:size nerd-icons--cache-limit))
(orig-fn (symbol-function func))
(unset (make-symbol "unset")))
(fset func
(lambda (&rest args)
(let ((value (gethash args cache unset)))
(when (eq value unset)
(when (> (hash-table-count cache)
nerd-icons--cache-limit)
(clrhash cache))
(setq value (puthash args (apply orig-fn args) cache)))
value))))
(put func 'nerd-icons--cached t)))