mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
Flocate_file_internal: Protect from .eln remapping
Don't use `openp`s functionality to remap `.elc` files to `.eln` files since `locate-file` is not specific to ELisp files. This should be not just simpler but more robust than the current hack which tries to undo the damage after the fact. * src/lread.c (Flocate_file_internal): Don't map `.elc` to `.eln`. * lisp/files.el (locate-file): Simplify accordingly.
This commit is contained in:
parent
e7ab69e762
commit
20d9c4b59f
2 changed files with 2 additions and 15 deletions
|
|
@ -987,20 +987,7 @@ one or more of those symbols."
|
|||
(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'."
|
||||
|
|
|
|||
|
|
@ -1661,7 +1661,7 @@ directories, make sure the PREDICATE function returns `dir-ok' for them. */)
|
|||
(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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue