]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/comp.el (comp-lookup-eln): Add new function.
authorAndrea Corallo <akrl@sdf.org>
Sun, 21 Mar 2021 20:24:26 +0000 (21:24 +0100)
committerAndrea Corallo <akrl@sdf.org>
Sun, 21 Mar 2021 20:50:22 +0000 (21:50 +0100)
lisp/emacs-lisp/comp.el

index 37b61edeb0c4d479d9ba0b2dd0c6829529dcdb77..e688d41f5d9025a21eb57ccbf654a472003d6ac8 100644 (file)
@@ -4099,6 +4099,20 @@ bytecode definition was not changed in the meantime)."
 \f
 ;;; Compiler entry points.
 
+(defun comp-lookup-eln (filename)
+  "Given a Lisp source FILENAME return the corresponding .eln file if found.
+Search happens in `comp-eln-load-path'."
+  (cl-loop
+   with eln-filename = (comp-el-to-eln-rel-filename filename)
+   for dir in comp-eln-load-path
+   for f = (expand-file-name eln-filename
+                             (expand-file-name comp-native-version-dir
+                                               (expand-file-name
+                                                dir
+                                                invocation-directory)))
+   when (file-exists-p f)
+     do (cl-return f)))
+
 ;;;###autoload
 (defun native-compile (function-or-file &optional output)
   "Compile FUNCTION-OR-FILE into native code.