Skip to content

Commit 7658287

Browse files
authored
Merge pull request #374 from syohex/ignored-var-in-match
Fix highlighting ignored variable in pattern match
2 parents a89a5bf + 42c1dab commit 7658287

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

elixir-mode.el

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -385,14 +385,6 @@ is used to limit the scan."
385385
(optional "="))
386386
1 elixir-atom-face)
387387

388-
;; Variable definitions
389-
(,(elixir-rx (group identifiers)
390-
(zero-or-more space)
391-
(repeat 1 "=")
392-
(or (or sigils identifiers space)
393-
(one-or-more "\n")))
394-
1 font-lock-variable-name-face)
395-
396388
;; Gray out variables starting with "_"
397389
(,(elixir-rx symbol-start
398390
(group (and "_"
@@ -401,6 +393,14 @@ is used to limit the scan."
401393
(optional (or "?" "!"))))
402394
1 font-lock-comment-face)
403395

396+
;; Variable definitions
397+
(,(elixir-rx (group identifiers)
398+
(zero-or-more space)
399+
(repeat 1 "=")
400+
(or (or sigils identifiers space)
401+
(one-or-more "\n")))
402+
1 font-lock-variable-name-face)
403+
404404
;; Map keys
405405
(,(elixir-rx (group (and (one-or-more identifiers) ":")) space)
406406
1 elixir-atom-face)

test/elixir-mode-font-test.el

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ end
527527

528528
(ert-deftest elixir-mode-syntax-table/question-quote ()
529529
"https://github.com/elixir-lang/emacs-elixir/issues/185"
530-
:tags '(fontification syntax-table hoge)
530+
:tags '(fontification syntax-table)
531531
(elixir-test-with-temp-buffer
532532
"\"\\\"foo\\\"\" |> String.strip(?\")"
533533
(should-not (eq (elixir-test-face-at 28) 'font-lock-string-face)))
@@ -536,6 +536,15 @@ end
536536
"\"\\\"foo\\\"\" |> String.strip(?')"
537537
(should-not (eq (elixir-test-face-at 28) 'font-lock-string-face))))
538538

539+
(ert-deftest elixir-mode-syntax-table/ignored-variables-in-pattern-match ()
540+
"https://github.com/elixir-lang/emacs-elixir/issues/361"
541+
:tags '(fontification syntax-table)
542+
(elixir-test-with-temp-buffer
543+
"(_1_day = 86_400)
544+
_1_day"
545+
(should (eq (elixir-test-face-at 2) 'font-lock-comment-face))
546+
(should (eq (elixir-test-face-at 19) 'font-lock-comment-face))))
547+
539548
(provide 'elixir-mode-font-test)
540549

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

0 commit comments

Comments
 (0)