Skip to content

Commit aee2b9b

Browse files
committed
Merge pull request #264 from syohex/fix-string-interpolation
Fix string interpolation
2 parents ae237fe + bfa64bb commit aee2b9b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

elixir-mode.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ is used to limit the scan."
256256
(defun elixir-syntax-propertize-interpolation ()
257257
(let* ((beg (match-beginning 0))
258258
(context (save-excursion (save-match-data (syntax-ppss beg)))))
259+
(put-text-property beg (1+ beg) 'syntax-table (string-to-syntax "w"))
259260
(put-text-property beg (1+ beg) 'elixir-interpolation
260261
(cons (nth 3 context) (match-data)))))
261262

test/elixir-mode-font-test.el

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,17 @@ when"
288288
(should-not (eq (elixir-test-face-at 67) 'font-lock-keyword-face))
289289
(should (eq (elixir-test-face-at 72) 'font-lock-keyword-face))))
290290

291+
(ert-deftest elixir-mode-syntax-table/string-interpolation-in-words-list ()
292+
"https://github.com/elixir-lang/emacs-elixir/issues/263"
293+
:tags '(fontification syntax-table)
294+
(elixir-test-with-temp-buffer
295+
"~w(SADD users #{user_id})"
296+
(should (eq (elixir-test-face-at 4) 'font-lock-string-face))
297+
298+
(should-not (eq (elixir-test-face-at 15) 'font-lock-comment-face))
299+
(should-not (eq (elixir-test-face-at 17) 'font-lock-comment-face))
300+
(should-not (eq (elixir-test-face-at 25) 'font-lock-comment-face))))
301+
291302
(provide 'elixir-mode-font-test)
292303

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

0 commit comments

Comments
 (0)