emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master f8bb6cca33: Return the same file from locate-file in nativecomp a


From: Lars Ingebrigtsen
Subject: master f8bb6cca33: Return the same file from locate-file in nativecomp and non
Date: Sat, 12 Mar 2022 16:32:21 -0500 (EST)

branch: master
commit f8bb6cca331cc487c4b3c16f33fe05a28fbacf01
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Return the same file from locate-file in nativecomp and non
    
    * lisp/files.el (locate-file): Return the .elc file (if it exists)
    in nativecomp, too, to mimic the behaviour from non-nativecomp
    builds (bug#51308).
---
 lisp/files.el | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lisp/files.el b/lisp/files.el
index a0501cffa1..327375ddaa 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -989,7 +989,16 @@ one or more of those symbols."
                  (if (memq 'readable predicate) 4 0))))
   (let ((file (locate-file-internal filename path suffixes predicate)))
     (if (and file (string-match "\\.eln\\'" file))
-        (gethash (file-name-nondirectory file) comp-eln-to-el-h)
+        ;; This is all a bit of a mess.  We pass in a list of suffixes
+        ;; that doesn't include .eln, but with a nativecomp emacs, we
+        ;; get the .eln file back.  We then map that to the .el file.
+        ;; But `load-history' has the .elc file, so that's the file we
+        ;; return here (if it exists).
+        (let* ((el (gethash (file-name-nondirectory file) comp-eln-to-el-h))
+               (elc (replace-regexp-in-string "\\.el\\'" ".elc" el)))
+          (if (file-exists-p elc)
+              elc
+            el))
       file)))
 
 (defun locate-file-completion-table (dirs suffixes string pred action)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]