Skip to content

Commit 4198d1e

Browse files
committed
Merge pull request #246 from syohex/issue-245
Fix highlighting true, false, nil
2 parents f899bc7 + 128e70c commit 4198d1e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

elixir-mode.el

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,9 @@ is used to limit the scan."
367367
1 font-lock-type-face)
368368

369369
;; Atoms and singleton-like words like true/false/nil.
370-
(,(elixir-rx (group (or atoms "true" "false" "nil"))
370+
(,(elixir-rx symbol-start
371+
(group (or atoms "true" "false" "nil"))
372+
symbol-end
371373
(zero-or-more space)
372374
(optional "="))
373375
1 elixir-atom-face)

test/elixir-mode-font-test.el

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ end"
173173
true
174174
false
175175
nil
176+
true_false_nil
176177
"
177178
(should (eq (elixir-test-face-at 3) 'elixir-atom-face))
178179
(should (eq (elixir-test-face-at 5) 'elixir-atom-face))
@@ -183,7 +184,8 @@ nil
183184
(should (eq (elixir-test-face-at 26) 'elixir-atom-face))
184185
(should (eq (elixir-test-face-at 43) 'elixir-atom-face))
185186
(should (eq (elixir-test-face-at 48) 'elixir-atom-face))
186-
(should (eq (elixir-test-face-at 54) 'elixir-atom-face))))
187+
(should (eq (elixir-test-face-at 54) 'elixir-atom-face))
188+
(should-not (eq (elixir-test-face-at 57) 'elixir-atom-face))))
187189

188190
(ert-deftest elixir-mode-syntax-table/fontify-map-keys ()
189191
:tags '(fontification map syntax-table)
@@ -246,6 +248,15 @@ some_expr"
246248
(should (eq (elixir-test-face-at 2) 'font-lock-variable-name-face))
247249
(should (eq (elixir-test-face-at 4) 'font-lock-variable-name-face))))
248250

251+
(ert-deftest elixir-mode-syntax-table/fontify-assignment-with-singleton ()
252+
"https://github.com/elixir-lang/emacs-elixir/issues/245"
253+
:tags '(fontification syntax-table)
254+
(elixir-test-with-temp-buffer
255+
"true_false_nil = 1"
256+
(should (eq (elixir-test-face-at 1) 'font-lock-variable-name-face))
257+
(should (eq (elixir-test-face-at 6) 'font-lock-variable-name-face))
258+
(should (eq (elixir-test-face-at 12) 'font-lock-variable-name-face))))
259+
249260
(provide 'elixir-mode-font-test)
250261

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

0 commit comments

Comments
 (0)