Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion elixir-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,9 @@ is used to limit the scan."
1 font-lock-type-face)

;; Atoms and singleton-like words like true/false/nil.
(,(elixir-rx (group (or atoms "true" "false" "nil"))
(,(elixir-rx symbol-start
(group (or atoms "true" "false" "nil"))
symbol-end
(zero-or-more space)
(optional "="))
1 elixir-atom-face)
Expand Down
13 changes: 12 additions & 1 deletion test/elixir-mode-font-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ end"
true
false
nil
true_false_nil
"
(should (eq (elixir-test-face-at 3) 'elixir-atom-face))
(should (eq (elixir-test-face-at 5) 'elixir-atom-face))
Expand All @@ -183,7 +184,8 @@ nil
(should (eq (elixir-test-face-at 26) 'elixir-atom-face))
(should (eq (elixir-test-face-at 43) 'elixir-atom-face))
(should (eq (elixir-test-face-at 48) 'elixir-atom-face))
(should (eq (elixir-test-face-at 54) 'elixir-atom-face))))
(should (eq (elixir-test-face-at 54) 'elixir-atom-face))
(should-not (eq (elixir-test-face-at 57) 'elixir-atom-face))))

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

(ert-deftest elixir-mode-syntax-table/fontify-assignment-with-singleton ()
"https://github.com/elixir-lang/emacs-elixir/issues/245"
:tags '(fontification syntax-table)
(elixir-test-with-temp-buffer
"true_false_nil = 1"
(should (eq (elixir-test-face-at 1) 'font-lock-variable-name-face))
(should (eq (elixir-test-face-at 6) 'font-lock-variable-name-face))
(should (eq (elixir-test-face-at 12) 'font-lock-variable-name-face))))

(provide 'elixir-mode-font-test)

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