]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/files.el (require-with-check): Fix last fix (bug#74289)
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 13 Nov 2024 16:39:05 +0000 (11:39 -0500)
committerEshel Yaron <me@eshelyaron.com>
Wed, 20 Nov 2024 12:32:24 +0000 (13:32 +0100)
(cherry picked from commit 8afcfed825ae60c8947c41d84b431b21f32b2714)

lisp/files.el

index f55227f3e16f22256993e4cadc40eb393cb20f8c..2274ff54287348508e9adc55c4f0bba94676ffd9 100644 (file)
@@ -1318,7 +1318,7 @@ NOERROR is equal to `reload'), or otherwise emit a warning."
         (res (require feature filename (if (eq noerror 'reload) nil noerror))))
     ;; If the `feature' was not yet provided, `require' just loaded the right
     ;; 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.
       (let* ((fn (locate-file (or filename (symbol-name feature))
                               load-path (get-load-suffixes) nil
@@ -1331,11 +1331,10 @@ NOERROR is equal to `reload'), or otherwise emit a warning."
              ;; we did load "it".  (bug#74040)
              ;; So use a "permissive" search which doesn't pay attention to
              ;; differences between file extensions.
-             (prefix (when fn
-                       (if (string-match
-                            (concat (regexp-opt (get-load-suffixes)) "\\'") fn)
-                           (concat (substring fn 0 (match-beginning 0)) ".")
-                         fn)))
+             (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)))))