mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-09 08:21:51 -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
|
elpa <- liftIO $ getDirectoryContents elpaDir
|
||||||
|
|
||||||
let getLib :: EmacsLib -> Maybe String = \case
|
let getLib :: EmacsLib -> Maybe String = \case
|
||||||
OwnFile f -> (("-l " <> lispDir) <>) <$> find (f `isInfixOf`) lisp
|
OwnFile f -> (("-l " <> lispDir) <>) <$> find (f `isPrefixOf`) lisp
|
||||||
ElpaLib d -> (("-L " <> elpaDir) <>) <$> find ((d <> "-") `isInfixOf`) elpa
|
ElpaLib d -> (("-L " <> elpaDir) <>) <$> find ((d <> "-") `isPrefixOf`) elpa
|
||||||
Special f -> Just $ " -l " <> f
|
Special f -> Just $ " -l " <> f
|
||||||
pure . mkDList . unwords . mapMaybe getLib $ libs
|
pure . mkDList . unwords . mapMaybe getLib $ libs
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user