emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 88a921f 35/47: Improve defun regexp.


From: Jackson Ray Hamilton
Subject: [elpa] master 88a921f 35/47: Improve defun regexp.
Date: Mon, 18 May 2015 09:52:02 +0000

branch: master
commit 88a921f641dccc268b3b35f07abbea1d1d8e30a6
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>

    Improve defun regexp.
---
 context-coloring.el |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index ae5ed90..ead1a79 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -389,14 +389,26 @@ generated by `js2-mode'."
 (defun context-coloring-stack-depth-equal (stack depth)
   (= (plist-get (car stack) :depth) depth))
 
+(defun context-coloring-exact-regexp (word)
+  "Create a regexp that matches exactly WORD."
+  (concat "\\`" (regexp-quote word) "\\'"))
+
+(defun context-coloring-exact-or-regexp (words)
+  "Create a regexp that matches any exact word in WORDS."
+  (context-coloring-join
+   (mapcar 'context-coloring-exact-regexp words) "\\|"))
+
 (defconst context-coloring-defun-regexp
-  "\\`defun\\'\\|\\`defmacro\\'\\|\\`defsubst\\'")
+  (context-coloring-exact-or-regexp
+   '("defun" "defun*" "defsubst" "defmacro"
+     "cl-defun" "cl-defsubst" "cl-defmacro")))
 
 (defconst context-coloring-arglist-arg-regexp
   "\\`[^&:]")
 
 (defconst context-coloring-ignored-word-regexp
-  "\\`[-+]?[0-9]\\|\\`t\\'\\|\\`nil\\'\\|\\`\\.\\'\\|\\`\\?\\'")
+  (concat "\\`[-+]?[0-9]\\|" (context-coloring-exact-or-regexp
+                              '("t" "nil" "." "?"))))
 
 (defconst context-coloring-COMMA-CHAR 44)
 (defconst context-coloring-BACKTICK-CHAR 96)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]