]> code.delx.au - gnu-emacs-elpa/commitdiff
Add macroexp-let2 support.
authorJackson Ray Hamilton <jackson@jacksonrayhamilton.com>
Sun, 8 Nov 2015 19:47:32 +0000 (11:47 -0800)
committerJackson Ray Hamilton <jackson@jacksonrayhamilton.com>
Sun, 8 Nov 2015 19:50:04 +0000 (11:50 -0800)
context-coloring.el
test/context-coloring-test.el
test/fixtures/macroexp-let2.el [new file with mode: 0644]

index 3010739d266985bb5aa4bdee9df613f6cbf7fc89..55d57eefbeec962cb5a5c5cfdd0496db3615f4c4 100644 (file)
@@ -815,6 +815,29 @@ Parsing the header with CALLBACK."
    (lambda ()
      (context-coloring-elisp-parse-let-varlist 'let*))))
 
+(defun context-coloring-elisp-colorize-macroexp-let2 ()
+  "Color the `macroexp-let2' at point."
+  (let (syntax-code
+        variable)
+    (context-coloring-elisp-colorize-scope
+     (lambda ()
+       (and
+        (progn
+          (setq syntax-code (context-coloring-get-syntax-code))
+          (context-coloring-elisp-identifier-p syntax-code))
+        (progn
+          (context-coloring-elisp-colorize-sexp)
+          (context-coloring-elisp-forward-sws)
+          (setq syntax-code (context-coloring-get-syntax-code))
+          (context-coloring-elisp-identifier-p syntax-code))
+        (progn
+          (context-coloring-elisp-parse-bindable
+           (lambda (parsed-variable)
+             (setq variable parsed-variable)))
+          (context-coloring-elisp-forward-sws)
+          (when variable
+            (context-coloring-elisp-add-variable variable))))))))
+
 (defun context-coloring-elisp-colorize-cond ()
   "Color the `cond' at point."
   (let (syntax-code)
@@ -933,6 +956,7 @@ Parsing the header with CALLBACK."
     (dolist (callee '("let" "gv-letplace"))
       (puthash callee #'context-coloring-elisp-colorize-let table))
     (puthash "let*" #'context-coloring-elisp-colorize-let* table)
+    (puthash "macroexp-let2" #'context-coloring-elisp-colorize-macroexp-let2 table)
     (puthash "lambda" #'context-coloring-elisp-colorize-lambda table)
     (puthash "cond" #'context-coloring-elisp-colorize-cond table)
     (puthash "defadvice" #'context-coloring-elisp-colorize-defadvice table)
index fc79f7b6c35bd1f7f3ac12eb7946745a7b2e8b82..0a1f88ed7595f9c94c29f1a871ba088534ee3753 100644 (file)
@@ -775,6 +775,16 @@ ssssssssssss0"))
   1111 1 1 1 0 0 000011"))
   :fixture "let-star.el")
 
+(context-coloring-test-deftest-emacs-lisp macroexp-let2
+  (lambda ()
+    (context-coloring-test-assert-coloring "
+1111 11111
+  222222222-2222 00000000-00000000-0 2 111
+    2 11121
+
+(11111111-1111 00000000-00000000-0)
+(11111111-1111)")))
+
 (context-coloring-test-deftest-emacs-lisp cond
   (lambda ()
     (context-coloring-test-assert-coloring "
diff --git a/test/fixtures/macroexp-let2.el b/test/fixtures/macroexp-let2.el
new file mode 100644 (file)
index 0000000..1b61df2
--- /dev/null
@@ -0,0 +1,6 @@
+(let (exp)
+  (macroexp-let2 macroexp-copyable-p v exp
+    v exp))
+
+(macroexp-let2 macroexp-copyable-p)
+(macroexp-let2)