Skip to content

Commit 1e66f47

Browse files
committed
Added with/1 to the highlighted keywords
- Added `with/1` to the keyword list - Added a test - Sorted the list of keywords alphabetically
1 parent 4f1b52c commit 1e66f47

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

elixir-mode.el

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@
142142
(and "\"" (one-or-more (not (any "\""))) "\"")
143143
(and "'" (one-or-more (not (any "'"))) "'"))))
144144
(builtin . ,(rx symbol-start
145-
(or "case" "cond" "for" "if" "unless" "try" "receive"
146-
"raise" "quote" "unquote" "unquote_splicing" "throw"
147-
"super" "send")
145+
(or "case" "cond" "for" "if" "quote" "raise" "receive" "send"
146+
"super" "throw" "try" "unless" "unquote" "unquote_splicing"
147+
"with")
148148
symbol-end))
149149
(builtin-declaration . ,(rx symbol-start
150150
(or "def" "defp" "defmodule" "defprotocol"

test/elixir-mode-font-test.el

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,21 @@ when"
321321
end"
322322
(should (eq (elixir-test-face-at 40) 'font-lock-keyword-face))))
323323

324+
(ert-deftest elixir-mode-syntax-table/highlight-with ()
325+
"Highlight with as a keyword"
326+
:tags '(fontification syntax-table)
327+
(elixir-test-with-temp-buffer
328+
"defmodule Foo do
329+
def bar(opts) do
330+
with(
331+
{:ok, width} <- Map.fetch(opts, :width),
332+
{:ok, height} <- Map.fetch(opts, :height),
333+
do: {:ok, width * height}
334+
)
335+
end
336+
end"
337+
(should (eq (elixir-test-face-at 41) 'font-lock-keyword-face))))
338+
324339
(ert-deftest elixir-mode-syntax-table/string-interpolation-in-words-list ()
325340
"https://github.com/elixir-lang/emacs-elixir/issues/263"
326341
:tags '(fontification syntax-table)

0 commit comments

Comments
 (0)