Function: find-library-name
find-library-name is a byte-compiled function defined in
find-func.el.gz.
Signature
(find-library-name LIBRARY)
Documentation
Return the absolute file name of the Emacs Lisp source of LIBRARY.
LIBRARY should be a string (the name of the library).
Probably introduced at or before Emacs version 26.1.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/find-func.el.gz
(defun find-library-name (library)
"Return the absolute file name of the Emacs Lisp source of LIBRARY.
LIBRARY should be a string (the name of the library)."
;; If the library is byte-compiled, try to find a source library by
;; the same name.
(cond
((string-match "\\.el\\(c\\(\\..*\\)?\\)\\'" library)
(setq library (replace-match "" t t library)))
((string-match "\\.eln\\'" library)
(setq library (gethash (file-name-nondirectory library) comp-eln-to-el-h))))
(or
(locate-file library
(or find-library-source-path load-path)
(find-library-suffixes))
(locate-file library
(or find-library-source-path load-path)
load-file-rep-suffixes)
(when (file-name-absolute-p library)
(let ((rel (find-library--load-name library)))
(when rel
(or
(locate-file rel
(or find-library-source-path load-path)
(find-library-suffixes))
(locate-file rel
(or find-library-source-path load-path)
load-file-rep-suffixes)))))
(find-library--from-load-history library)
(signal 'file-error (list "Can't find library" library))))