From e772e8942c141e482fc4c768bf67da407d24f16c Mon Sep 17 00:00:00 2001 From: Syohei YOSHIDA Date: Sat, 3 Oct 2015 11:24:12 +0900 Subject: [PATCH 1/2] Add unit test for #263 This is a string interpolation in words list test. --- test/elixir-mode-font-test.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/elixir-mode-font-test.el b/test/elixir-mode-font-test.el index b10d1557..c95dfa5b 100644 --- a/test/elixir-mode-font-test.el +++ b/test/elixir-mode-font-test.el @@ -288,6 +288,17 @@ when" (should-not (eq (elixir-test-face-at 67) 'font-lock-keyword-face)) (should (eq (elixir-test-face-at 72) 'font-lock-keyword-face)))) +(ert-deftest elixir-mode-syntax-table/string-interpolation-in-words-list () + "https://github.com/elixir-lang/emacs-elixir/issues/263" + :tags '(fontification syntax-table) + (elixir-test-with-temp-buffer + "~w(SADD users #{user_id})" + (should (eq (elixir-test-face-at 4) 'font-lock-string-face)) + + (should-not (eq (elixir-test-face-at 15) 'font-lock-comment-face)) + (should-not (eq (elixir-test-face-at 17) 'font-lock-comment-face)) + (should-not (eq (elixir-test-face-at 25) 'font-lock-comment-face)))) + (provide 'elixir-mode-font-test) ;;; elixir-mode-font-test.el ends here From bfa64bba0fa27ddaa2838bfd0b3e41c2559bfbf0 Mon Sep 17 00:00:00 2001 From: Syohei YOSHIDA Date: Sat, 3 Oct 2015 11:25:07 +0900 Subject: [PATCH 2/2] Replace comment syntax property of string interpolation(#{}) Because it is not comment symbol. --- elixir-mode.el | 1 + 1 file changed, 1 insertion(+) diff --git a/elixir-mode.el b/elixir-mode.el index 8a9a80f3..0f0e59b5 100644 --- a/elixir-mode.el +++ b/elixir-mode.el @@ -256,6 +256,7 @@ is used to limit the scan." (defun elixir-syntax-propertize-interpolation () (let* ((beg (match-beginning 0)) (context (save-excursion (save-match-data (syntax-ppss beg))))) + (put-text-property beg (1+ beg) 'syntax-table (string-to-syntax "w")) (put-text-property beg (1+ beg) 'elixir-interpolation (cons (nth 3 context) (match-data)))))