Skip to content

Commit

Permalink
Merge pull request #90 from elixir-lang/atom-highlighting
Browse files Browse the repository at this point in the history
Fix bug in atom highlighting.
  • Loading branch information
mattdeboard committed Aug 19, 2014
2 parents a69113b + c162b50 commit 5256ad2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
9 changes: 5 additions & 4 deletions elixir-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@
(and "<" (group (one-or-more (not (any ">")))) ">"))
1 font-lock-string-face)

;; TODO: Figure out why atoms are not being colored with `reference-face'
;; Atoms and singleton-like words like true/false/nil.
(,(elixir-rx (or (group atoms) (group bool-and-nil)))
1 font-lock-reference-face)

;; Built-in modules
(,(elixir-rx (group builtin-modules))
1 font-lock-constant-face)
Expand All @@ -396,10 +401,6 @@
(,(elixir-rx (group operators))
1 elixir-operator-face)

;; Atoms and singleton-like words like true/false/nil.
(,(elixir-rx (group (or atoms bool-and-nil)))
1 font-lock-reference-face)

;; Code points
(,(elixir-rx (group code-point))
1 elixir-negation-face)))
Expand Down
2 changes: 1 addition & 1 deletion elixir-smie.el
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
(modify-syntax-entry ?\} "){" table)
(modify-syntax-entry ?\[ "(]" table)
(modify-syntax-entry ?\] ")[" table)
(modify-syntax-entry ?\: "'" table)
(modify-syntax-entry ?: "_" table)
(modify-syntax-entry ?@ "_" table)
table)
"Elixir mode syntax table.")
Expand Down
13 changes: 13 additions & 0 deletions test/elixir-mode-font-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,16 @@ end"
(should (eq (elixir-test-face-at 2) 'font-lock-builtin-face))
(should (eq (elixir-test-face-at 3) 'font-lock-string-face))))

(ert-deftest elixir-mode-syntax-table/fontify-atoms ()
:tags '(fontification atom syntax-table)
(elixir-test-with-temp-buffer
":oriole
:andale"
;; This is actually the wrong face. I thought I had set these up
;; to use `font-lock-reference-face' but apparently not. See the
;; TODO in `elixir-mode.el' on this.
(should (eq (elixir-test-face-at 3) 'font-lock-constant-face))
(should (eq (elixir-test-face-at 5) 'font-lock-constant-face))
(should (eq (elixir-test-face-at 10) 'font-lock-constant-face))
(should (eq (elixir-test-face-at 13) 'font-lock-constant-face))))

0 comments on commit 5256ad2

Please sign in to comment.