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 @@ -185,7 +185,9 @@ for the Elixir programming language."
`(
(atoms . ,(rx ":"
(or
(one-or-more (any "a-z" "A-Z" "_" "\"" "'"))
(and
(any "a-z" "A-Z" "_" "\"" "'")
(zero-or-more (any "a-z" "A-Z" "0-9" "_" "\"" "'")))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change from one-or-more to zero-or-more? This doesn't make sense to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old regexp was:

(or 
  (one-or-more (any "a-z" "A-Z" "_" "\"" "'"))

...)

Which matches only :msisdn in the :msisdn2pid atom, leaving 2pid unhighlighted as described in #172.

By changing it to

(or 
  (and
    (any "a-z" "A-Z" "_" "\"" "'")
    (zero-or-more (any "a-z" "A-Z" "0-9" "_" "\"" "'")))

I ask for the first character in '("a-z" "A-Z" "_" "\"" "'") and the subsequent ones in '("a-z" "A-Z" "0-9" "_" "\"" "'"). This in turn matches the whole :msisdn2pid atom.

Sorry, I should've added more context to the PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks

(and "\"" (one-or-more (not (any "\""))) "\"")
(and "'" (one-or-more (not (any "'"))) "'"))))
(builtin . ,(rx symbol-start
Expand Down
7 changes: 5 additions & 2 deletions test/elixir-mode-font-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,14 @@ end"
:tags '(fontification atom syntax-table)
(elixir-test-with-temp-buffer
":oriole
:andale"
:andale
:ms2pid"
(should (eq (elixir-test-face-at 3) 'elixir-atom-face))
(should (eq (elixir-test-face-at 5) 'elixir-atom-face))
(should (eq (elixir-test-face-at 10) 'elixir-atom-face))
(should (eq (elixir-test-face-at 13) 'elixir-atom-face))))
(should (eq (elixir-test-face-at 13) 'elixir-atom-face))
(should (eq (elixir-test-face-at 18) 'elixir-atom-face))
(should (eq (elixir-test-face-at 23) 'elixir-atom-face))))

(ert-deftest elixir-mode-syntax-table/fontify-map-keys ()
:tags '(fontification map syntax-table)
Expand Down