Skip to content

Commit 0e222af

Browse files
committed
fix: fontify defguard and defguardp
Those were included on Elixir 1.7 and were not being fontified.
1 parent 90323cd commit 0e222af

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

elixir-mode.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@
124124
(or "def" "defp" "defmodule" "defprotocol"
125125
"defmacro" "defmacrop" "defdelegate"
126126
"defexception" "defstruct" "defimpl"
127-
"defcallback" "defoverridable")
127+
"defguard" "defguardp" "defcallback"
128+
"defoverridable")
128129
symbol-end))
129130
(builtin-namespace . ,(rx symbol-start
130131
(or "import" "require" "use" "alias")

test/elixir-mode-font-test.el

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,22 @@ x = 15"
110110
x = 15"
111111
(should (eq (elixir-test-face-at 15) 'font-lock-variable-name-face))))
112112

113+
(ert-deftest elixir-mode-syntax-table/fontify-defguard ()
114+
:tags '(fontification syntax-table)
115+
(elixir-test-with-temp-buffer
116+
"defmodule Foo do
117+
defguard is_foo(arg) when arg == true
118+
end"
119+
(should (eq (elixir-test-face-at 18) 'font-lock-keyword-face))))
120+
121+
(ert-deftest elixir-mode-syntax-table/fontify-defguardp ()
122+
:tags '(fontification syntax-table)
123+
(elixir-test-with-temp-buffer
124+
"defmodule Foo do
125+
defguardp is_foo(arg) when arg == true
126+
end"
127+
(should (eq (elixir-test-face-at 18) 'font-lock-keyword-face))))
128+
113129
(ert-deftest elixir-mode-syntax-table/fontify-function-name/1 ()
114130
:tags '(fontification syntax-table)
115131
(elixir-test-with-temp-buffer
@@ -587,8 +603,6 @@ Everything in here should be gray, including the @doc and triple-quotes
587603
(search-forward "Everything")
588604
(should (eq 'font-lock-doc-face (get-char-property (point) 'face)))))
589605

590-
591-
592606
(provide 'elixir-mode-font-test)
593607

594608
;;; elixir-mode-font-test.el ends here

0 commit comments

Comments
 (0)