From 8b95883e036f5fe59c1c386a01fb41c411f8d0e0 Mon Sep 17 00:00:00 2001
From: Francois-Rene Rideau <tunes@google.com>
Date: Tue, 22 Oct 2013 15:37:15 -0400
Subject: [PATCH] Treat sysdef-preloaded-system-search specially at the end of
 the search to give extensions (such as quicklisp) every chance to bypass it.
 (Thanks to Dave Cooper for noticing the bug.)

---
 find-system.lisp | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/find-system.lisp b/find-system.lisp
index 92687905..2c4f38dd 100644
--- a/find-system.lisp
+++ b/find-system.lisp
@@ -125,7 +125,7 @@ called with an object of type asdf:system."
     (setf *system-definition-search-functions*
           (append
            ;; Remove known-incompatible sysdef functions from old versions of asdf.
-           (remove-if #'(lambda (x) (member x '(contrib-sysdef-search sysdef-find-asdf)))
+           (remove-if #'(lambda (x) (member x '(contrib-sysdef-search sysdef-find-asdf sysdef-preloaded-system-search)))
                       *system-definition-search-functions*)
            ;; Tuck our defaults at the end of the list if they were absent.
            ;; This is imperfect, in case they were removed on purpose,
@@ -133,14 +133,16 @@ called with an object of type asdf:system."
            ;; to upgrade asdf before he does such a thing rather than after.
            (remove-if #'(lambda (x) (member x *system-definition-search-functions*))
                       '(sysdef-central-registry-search
-                        sysdef-source-registry-search
-                        sysdef-preloaded-system-search)))))
+                        sysdef-source-registry-search)))))
   (cleanup-system-definition-search-functions)
 
   (defun search-for-system-definition (system)
-    (some (let ((name (coerce-name system))) #'(lambda (x) (funcall x name)))
-          (cons 'find-system-if-being-defined
-                *system-definition-search-functions*)))
+    (block ()
+      (let ((name (coerce-name system)))
+        (flet ((try (f) (if-let ((x (funcall f name))) (return x))))
+          (try 'find-system-if-being-defined)
+          (map () #'try *system-definition-search-functions*)
+          (try 'sysdef-preloaded-system-search)))))
 
   (defvar *central-registry* nil
     "A list of 'system directory designators' ASDF uses to find systems.
-- 
GitLab