1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

* lisp/files.el (require-with-check): Fix last fix (bug#74289)

This commit is contained in:
Stefan Monnier 2024-11-13 11:39:05 -05:00
parent 3496234c8e
commit 8afcfed825

View File

@ -1275,7 +1275,7 @@ NOERROR is equal to `reload'), or otherwise emit a warning."
(res (require feature filename (if (eq noerror 'reload) nil noerror)))) (res (require feature filename (if (eq noerror 'reload) nil noerror))))
;; If the `feature' was not yet provided, `require' just loaded the right ;; If the `feature' was not yet provided, `require' just loaded the right
;; file, so we're done. ;; file, so we're done.
(when (eq lh load-history) (when (and res (eq lh load-history))
;; If `require' did nothing, we need to make sure that was warranted. ;; If `require' did nothing, we need to make sure that was warranted.
(let* ((fn (locate-file (or filename (symbol-name feature)) (let* ((fn (locate-file (or filename (symbol-name feature))
load-path (get-load-suffixes) nil load-path (get-load-suffixes) nil
@ -1288,11 +1288,10 @@ NOERROR is equal to `reload'), or otherwise emit a warning."
;; we did load "it". (bug#74040) ;; we did load "it". (bug#74040)
;; So use a "permissive" search which doesn't pay attention to ;; So use a "permissive" search which doesn't pay attention to
;; differences between file extensions. ;; differences between file extensions.
(prefix (when fn (prefix (if (string-match
(if (string-match
(concat (regexp-opt (get-load-suffixes)) "\\'") fn) (concat (regexp-opt (get-load-suffixes)) "\\'") fn)
(concat (substring fn 0 (match-beginning 0)) ".") (concat (substring fn 0 (match-beginning 0)) ".")
fn))) fn))
(lh load-history)) (lh load-history))
(while (and lh (let ((file (car-safe (car lh)))) (while (and lh (let ((file (car-safe (car lh))))
(not (and file (string-prefix-p prefix file))))) (not (and file (string-prefix-p prefix file)))))