diff options
author | Eli Zaretskii <eliz@gnu.org> | 2024-11-02 08:34:42 -0400 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2024-11-02 08:34:42 -0400 |
commit | 9bc6362d6e43e99cfe2dea8748e29e63c65985c0 (patch) | |
tree | 147ec9ea92222a38833cb0cef79ef567d14df682 /lisp/files.el | |
parent | 74d3232522f762742e9acaf9e62b9fd6d63ae380 (diff) | |
parent | 98796f95fa5ce7c38074429517c477cd01b0be37 (diff) | |
download | emacs-9bc6362d6e43e99cfe2dea8748e29e63c65985c0.tar.gz emacs-9bc6362d6e43e99cfe2dea8748e29e63c65985c0.tar.bz2 emacs-9bc6362d6e43e99cfe2dea8748e29e63c65985c0.zip |
Merge from origin/emacs-30
98796f95fa5 Work on proced-tests.el
8a4d13e370c ; * doc/lispref/frames.texi (Yanking Media): Add index en...
0aae02a3741 * lisp/files.el (require-with-check): Be a bit more lenie...
cc6a11f4832 (with-peg-rules): Fix references to rulesets (bug#74018)
70f084db2ff ; * etc/NEWS: Fix typo (bug#74066).
9e1abf11fc1 Tweak doc w.r.t to "void function" (bug#73886)
7a8ca202c5e Fix flakey proced refine tests (Bug#73441)
55a8cec013e Another 'void' update
Diffstat (limited to 'lisp/files.el')
-rw-r--r-- | lisp/files.el | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/lisp/files.el b/lisp/files.el index 9c105dbe1a5..54f2397ee37 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1276,10 +1276,27 @@ NOERROR is equal to `reload'), or otherwise emit a warning." ;; file, so we're done. (when (eq lh load-history) ;; If `require' did nothing, we need to make sure that was warranted. - (let ((fn (locate-file (or filename (symbol-name feature)) - load-path (get-load-suffixes)))) + (let* ((fn (locate-file (or filename (symbol-name feature)) + load-path (get-load-suffixes) nil + )) ;; load-prefer-newer + ;; We used to look for `fn' in `load-history' with `assoc' + ;; which works in most cases, but in some cases (e.g. when + ;; `load-prefer-newer' is set) `locate-file' can return a + ;; different file than the file that `require' would load, + ;; so the file won't be found in `load-history' even though + ;; we did load "it". (bug#74040) + ;; So use a "permissive" search which doesn't pay attention to + ;; differences between file extensions. + (prefix (if (string-match + (concat (regexp-opt (get-load-suffixes)) "\\'") fn) + (concat (substring fn 0 (match-beginning 0)) ".") + fn)) + (lh load-history)) + (while (and lh (let ((file (car-safe (car lh)))) + (not (and file (string-prefix-p prefix file))))) + (setq lh (cdr lh))) (cond - ((assoc fn load-history) nil) ;We loaded the right file. + (lh nil) ;We loaded the right file. ((eq noerror 'reload) (load fn nil 'nomessage)) ((and fn (memq feature features)) (let ((oldfile (symbol-file feature 'provide))) |