Skip to content

Commit 5256ad2

Browse files
committed
Merge pull request #90 from elixir-lang/atom-highlighting
Fix bug in atom highlighting.
2 parents a69113b + c162b50 commit 5256ad2

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

elixir-mode.el

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,11 @@
388388
(and "<" (group (one-or-more (not (any ">")))) ">"))
389389
1 font-lock-string-face)
390390

391+
;; TODO: Figure out why atoms are not being colored with `reference-face'
392+
;; Atoms and singleton-like words like true/false/nil.
393+
(,(elixir-rx (or (group atoms) (group bool-and-nil)))
394+
1 font-lock-reference-face)
395+
391396
;; Built-in modules
392397
(,(elixir-rx (group builtin-modules))
393398
1 font-lock-constant-face)
@@ -396,10 +401,6 @@
396401
(,(elixir-rx (group operators))
397402
1 elixir-operator-face)
398403

399-
;; Atoms and singleton-like words like true/false/nil.
400-
(,(elixir-rx (group (or atoms bool-and-nil)))
401-
1 font-lock-reference-face)
402-
403404
;; Code points
404405
(,(elixir-rx (group code-point))
405406
1 elixir-negation-face)))

elixir-smie.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
(modify-syntax-entry ?\} "){" table)
3030
(modify-syntax-entry ?\[ "(]" table)
3131
(modify-syntax-entry ?\] ")[" table)
32-
(modify-syntax-entry ?\: "'" table)
32+
(modify-syntax-entry ?: "_" table)
3333
(modify-syntax-entry ?@ "_" table)
3434
table)
3535
"Elixir mode syntax table.")

test/elixir-mode-font-tests.el

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,16 @@ end"
124124
(should (eq (elixir-test-face-at 2) 'font-lock-builtin-face))
125125
(should (eq (elixir-test-face-at 3) 'font-lock-string-face))))
126126

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

0 commit comments

Comments
 (0)