]> code.delx.au - gnu-emacs-elpa/commitdiff
Support comma splicing.
authorJackson Ray Hamilton <jackson@jacksonrayhamilton.com>
Sat, 30 May 2015 21:35:20 +0000 (14:35 -0700)
committerJackson Ray Hamilton <jackson@jacksonrayhamilton.com>
Sat, 30 May 2015 21:35:20 +0000 (14:35 -0700)
context-coloring.el
test/context-coloring-test.el
test/fixtures/splice.el [new file with mode: 0644]

index 61f5a31a63571e0db6e814d05858ebb39e015c75..61c41635efc3bf18cdb79a2ba0298bbb3124ecaa 100644 (file)
@@ -330,6 +330,7 @@ generated by `js2-mode'."
 (defconst context-coloring-APOSTROPHE-CHAR (string-to-char "'"))
 (defconst context-coloring-OPEN-PARENTHESIS-CHAR (string-to-char "("))
 (defconst context-coloring-COMMA-CHAR (string-to-char ","))
+(defconst context-coloring-AT-CHAR (string-to-char "@"))
 (defconst context-coloring-BACKTICK-CHAR (string-to-char "`"))
 
 (defvar context-coloring-elisp-scope-stack '())
@@ -608,6 +609,9 @@ generated by `js2-mode'."
         (setq char (char-after))
         (when (= char context-coloring-COMMA-CHAR)
           (forward-char)
+          (when (= (char-after) context-coloring-AT-CHAR)
+            ;; If we don't do this "@" could be interpreted as a symbol.
+            (forward-char))
           (context-coloring-forward-sws)
           (context-coloring-elisp-colorize-sexp)))))))
 
index c21cb3da27c93160b86c3cdcc777a57d2b1df2e1..c0240b52f4e41dbbc2a635b4a7df7e198f98f075 100644 (file)
@@ -1107,6 +1107,12 @@ ssssssssssss0"))
 
 (xxxxxx () 111111 11111)")))
 
+(context-coloring-test-deftest-emacs-lisp splice
+  (lambda ()
+    (context-coloring-test-assert-coloring "
+(xxxxxx ()
+  111111 00001 100001)")))
+
 (context-coloring-test-deftest-emacs-lisp comment
   (lambda ()
     ;; Just check that the comment isn't parsed syntactically.
diff --git a/test/fixtures/splice.el b/test/fixtures/splice.el
new file mode 100644 (file)
index 0000000..3a857a7
--- /dev/null
@@ -0,0 +1,2 @@
+(lambda ()
+  `(,@(a free) ,free))