mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-07-31 12:11:52 -07:00
X.U.Run: Use isPrefixOf in withEmacsLibs
The `lisp` and `elpa` lists will simply be the (unqualified) file names. Thus, if we use isInfixOf and try to require a library with a very short name (like s.el), other things may be chosen over it. isPrefixOf, together with the additional `-`, prevents this from happening.
This commit is contained in:
@@ -478,8 +478,8 @@ withEmacsLibs libs = XC.withDef $ \ProcessConfig{emacsLispDir, emacsElpaDir} ->
|
||||
elpa <- liftIO $ getDirectoryContents elpaDir
|
||||
|
||||
let getLib :: EmacsLib -> Maybe String = \case
|
||||
OwnFile f -> (("-l " <> lispDir) <>) <$> find (f `isInfixOf`) lisp
|
||||
ElpaLib d -> (("-L " <> elpaDir) <>) <$> find ((d <> "-") `isInfixOf`) elpa
|
||||
OwnFile f -> (("-l " <> lispDir) <>) <$> find (f `isPrefixOf`) lisp
|
||||
ElpaLib d -> (("-L " <> elpaDir) <>) <$> find ((d <> "-") `isPrefixOf`) elpa
|
||||
Special f -> Just $ " -l " <> f
|
||||
pure . mkDList . unwords . mapMaybe getLib $ libs
|
||||
|
||||
|
Reference in New Issue
Block a user