Merge branch 'master' of ssh://darcs.haskell.org/srv/darcs/ghc
authorMax Bolingbroke <batterseapower@hotmail.com>
Sat, 2 Apr 2011 23:04:24 +0000 (00:04 +0100)
committerMax Bolingbroke <batterseapower@hotmail.com>
Sat, 2 Apr 2011 23:04:24 +0000 (00:04 +0100)
ghc/InteractiveUI.hs

index 3062133..2685377 100644 (file)
@@ -848,8 +848,11 @@ lookupCommand' str' = do
   macros <- readIORef macros_ref
   let{ (str, cmds) = case str' of
       ':' : rest -> (rest, builtin_commands)
-      _ -> (str', macros ++ builtin_commands) }
+      _ -> (str', builtin_commands ++ macros) }
   -- look for exact match first, then the first prefix match
+  -- We consider builtin commands first: since new macros are appended
+  -- on the *end* of the macros list, this is consistent with the view
+  -- that things defined earlier should take precedence. See also #3858
   return $ case [ c | c <- cmds, str == cmdName c ] of
            c:_ -> Just c
            [] -> case [ c | c@(s,_,_) <- cmds, str `isPrefixOf` s ] of