Function: marginalia--library-cache

marginalia--library-cache is a natively compiled function defined in marginalia.el.

Signature

(marginalia--library-cache)

Documentation

Return hash table from library name to library file.

Source Code

;; Defined in /nix/store/hym71by08nv7fpgl7asan3dvidx05yya-emacs-packages-deps/share/emacs/site-lisp/elpa/marginalia-20260926.1228/marginalia.el
(defun marginalia--library-cache ()
  "Return hash table from library name to library file."
  (marginalia--in-minibuffer
    (with-memoization marginalia--library-cache
      ;; `locate-file' and `locate-library' are bottlenecks for the
      ;; annotator. Therefore we compute all the library paths first.
      (let ((cache (make-hash-table :test #'equal)))
        (dolist (dir (delete-dups
                      (reverse ;; Reverse because of shadowing
                       (append load-path (custom-theme--load-path))))) ;; Include themes
          (dolist (file (ignore-errors
                          (directory-files dir 'full
                                           "\\.el\\(?:\\.gz\\)?\\'")))
            (puthash (marginalia--library-name file) file cache)))
        cache))))