emacs-devel
[Top][All Lists]
Advanced

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

Re: master f8bb6cca33: Return the same file from locate-file in nativeco


From: Stefan Monnier
Subject: Re: master f8bb6cca33: Return the same file from locate-file in nativecomp and non
Date: Sat, 12 Mar 2022 18:23:36 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Lars Ingebrigtsen [2022-03-12 22:51:01] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> IOW the patch above makes things closer to what they should be, but
>> we should simply not need that because locate-file-internal should not
>> magically replace `.elc` files with `.eln` files.
> Indeed.  Patches welcome.

How 'bout


        Stefan


diff --git a/lisp/files.el b/lisp/files.el
index 7be93662b1c..eca8cba93f2 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -987,20 +987,7 @@ locate-file
          (logior (if (memq 'executable predicate) 1 0)
                  (if (memq 'writable predicate) 2 0)
                  (if (memq 'readable predicate) 4 0))))
-  (let ((file (locate-file-internal filename path suffixes predicate)))
-    (if (and file (string-match "\\.eln\\'" file))
-        ;; 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 (and (member ".elc" suffixes)
-                   (file-exists-p elc))
-              elc
-            el))
-      file)))
+  (locate-file-internal filename path suffixes predicate))
 
 (defun locate-file-completion-table (dirs suffixes string pred action)
   "Do completion for file names passed to `locate-file'."
diff --git a/src/lread.c b/src/lread.c
index 0486a98883c..d7b56c5087e 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1661,7 +1661,7 @@ DEFUN ("locate-file-internal", Flocate_file_internal, 
Slocate_file_internal, 2,
   (Lisp_Object filename, Lisp_Object path, Lisp_Object suffixes, Lisp_Object 
predicate)
 {
   Lisp_Object file;
-  int fd = openp (path, filename, suffixes, &file, predicate, false, false);
+  int fd = openp (path, filename, suffixes, &file, predicate, false, true);
   if (NILP (predicate) && fd >= 0)
     emacs_close (fd);
   return file;




reply via email to

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