Skip to content

Commit 870a419

Browse files
committed
Correctly capitalize Emacs
1 parent 70428dc commit 870a419

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

app/Main.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ cliParser =
5050
Data.Foldable.asum
5151
[ pure Nothing
5252
, Just VSCode <$ switch (long "code" <> help "Generate for the VS Code editor")
53-
, Just EMacs <$ switch (long "emacs" <> help "Generate for the EMacs editor")
53+
, Just Emacs <$ switch (long "emacs" <> help "Generate for the Emacs editor")
5454
]
5555
seed :: Parser (Maybe Int)
5656
seed = optional $ option auto (long "seed" <> short 's' <> metavar "INT" <> help "Seed to use for world generation")

src/Swarm/DocGen.hs

+12-12
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module Swarm.DocGen (
99
keywordsCommands,
1010
keywordsDirections,
1111
operatorNames,
12-
builtinCommandsListEMacs,
12+
builtinCommandsListEmacs,
1313
editorList,
1414
) where
1515

@@ -55,7 +55,7 @@ data GenerateDocs where
5555
EditorKeywords :: Maybe EditorType -> GenerateDocs
5656
deriving (Eq, Show)
5757

58-
data EditorType = EMacs | VSCode
58+
data EditorType = Emacs | VSCode
5959
deriving (Eq, Show, Enum, Bounded)
6060

6161
generateDocs :: GenerateDocs -> IO ()
@@ -79,12 +79,12 @@ generateDocs = \case
7979

8080
generateEditorKeywords :: EditorType -> IO ()
8181
generateEditorKeywords = \case
82-
EMacs -> do
82+
Emacs -> do
8383
putStrLn "(x-builtins '("
84-
T.putStr . editorList EMacs $ map constSyntax builtinCommandsEMacs
84+
T.putStr . editorList Emacs $ map constSyntax builtinCommandsEmacs
8585
putStrLn "))\n(x-commands '("
86-
T.putStr $ keywordsCommands EMacs
87-
T.putStr $ keywordsDirections EMacs
86+
T.putStr $ keywordsCommands Emacs
87+
T.putStr $ keywordsDirections Emacs
8888
putStrLn "))"
8989
VSCode -> do
9090
putStrLn "Functions and commands:"
@@ -94,15 +94,15 @@ generateEditorKeywords = \case
9494
putStrLn "\nOperators:"
9595
T.putStrLn operatorNames
9696

97-
builtinCommandsEMacs :: [Const]
98-
builtinCommandsEMacs = [If, Run, Return, Try, Fail, Force, Fst, Snd]
97+
builtinCommandsEmacs :: [Const]
98+
builtinCommandsEmacs = [If, Run, Return, Try, Fail, Force, Fst, Snd]
9999

100-
builtinCommandsListEMacs :: Text
101-
builtinCommandsListEMacs = editorList EMacs $ map constSyntax builtinCommandsEMacs
100+
builtinCommandsListEmacs :: Text
101+
builtinCommandsListEmacs = editorList Emacs $ map constSyntax builtinCommandsEmacs
102102

103103
editorList :: EditorType -> [Text] -> Text
104104
editorList = \case
105-
EMacs -> T.unlines . map ((" " <>) . quote)
105+
Emacs -> T.unlines . map ((" " <>) . quote)
106106
VSCode -> T.intercalate "|"
107107
where
108108
quote = T.cons '"' . flip T.snoc '"'
@@ -114,7 +114,7 @@ constSyntax = Syntax.syntax . Syntax.constInfo
114114
keywordsCommands :: EditorType -> Text
115115
keywordsCommands e = editorList e $ map constSyntax (filter isFunc Syntax.allConst)
116116
where
117-
isFunc c = Syntax.isUserFunc c && (e /= EMacs || c `notElem` builtinCommandsEMacs)
117+
isFunc c = Syntax.isUserFunc c && (e /= Emacs || c `notElem` builtinCommandsEmacs)
118118

119119
-- | Get formatted list of directions.
120120
keywordsDirections :: EditorType -> Text

test/integration/Main.hs

+5-5
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,15 @@ testEditorFiles =
232232
, testTextInVSCode "directions" DocGen.keywordsDirections
233233
]
234234
, testGroup
235-
"EMacs"
236-
[ testTextInEMacs "builtin" (const DocGen.builtinCommandsListEMacs)
237-
, testTextInEMacs "commands" DocGen.keywordsCommands
238-
, testTextInEMacs "directions" DocGen.keywordsDirections
235+
"Emacs"
236+
[ testTextInEmacs "builtin" (const DocGen.builtinCommandsListEmacs)
237+
, testTextInEmacs "commands" DocGen.keywordsCommands
238+
, testTextInEmacs "directions" DocGen.keywordsDirections
239239
]
240240
]
241241
where
242242
testTextInVSCode name tf = testTextInFile False name (tf VSCode) "editors/vscode/syntaxes/swarm.tmLanguage.json"
243-
testTextInEMacs name tf = testTextInFile True name (tf EMacs) "editors/emacs/swarm-mode.el"
243+
testTextInEmacs name tf = testTextInFile True name (tf Emacs) "editors/emacs/swarm-mode.el"
244244
testTextInFile :: Bool -> String -> Text -> FilePath -> TestTree
245245
testTextInFile whitespace name t fp = testCase name $ do
246246
let removeLW' = T.unlines . map (T.dropWhile isSpace) . T.lines

0 commit comments

Comments
 (0)