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

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

[elpa] master ffb8c5d 21/27: Merge pull request #3 from plexus/add-elisp


From: Dmitry Gutov
Subject: [elpa] master ffb8c5d 21/27: Merge pull request #3 from plexus/add-elisp-clojure
Date: Sat, 29 Oct 2016 00:04:19 +0000 (UTC)

branch: master
commit ffb8c5da19ffd2a71003b93fe33f78d0900fad9e
Merge: 083954e a031ee2
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Merge pull request #3 from plexus/add-elisp-clojure
    
    Add Emacs Lisp and Clojure (same as Java)
---
 highlight-escape-sequences.el |   33 ++++++++++++++++++++++++++-------
 1 file changed, 26 insertions(+), 7 deletions(-)

diff --git a/highlight-escape-sequences.el b/highlight-escape-sequences.el
index 8245b76..2c8d678 100644
--- a/highlight-escape-sequences.el
+++ b/highlight-escape-sequences.el
@@ -154,6 +154,23 @@ Currently doesn't handle \\C-, \\M-, etc.")
             nil))
         prepend))))
 
+(defconst hes-elisp-escape-sequence-re
+  (rx (submatch
+       (and ?\\ (submatch
+                 (or
+                  (and ?u (repeat 4 xdigit))
+                  (and ?U ?0 ?0 (repeat 6 xdigit))
+                  (and ?x (+ xdigit)) ;; variable number hex digits
+                  (+ (in "0-7"))      ;; variable number octal digits
+                  not-newline)))))
+
+  "Regexp to match Emacs Lisp escape sequences.
+
+Currently handles:
+- unicodes (\\uNNNN and \\U00NNNNNN)
+- hexadecimal (\\x...) and octal (\\0-7), variable number of digits
+- backslash followed by anything else.")
+
 (defun hes-make-simple-escape-sequence-keywords(re)
   `((,re
      (1 (when (nth 3 (syntax-ppss))
@@ -167,13 +184,15 @@ Currently doesn't handle \\C-, \\M-, etc.")
   "Modes where escape sequences can appear in any string literal.")
 
 (defcustom hes-mode-alist
-  `((c-mode    . ,hes-c/c++/objc-escape-sequence-re)
-    (c++-mode  . ,hes-c/c++/objc-escape-sequence-re)
-    (objc-mode . ,hes-c/c++/objc-escape-sequence-re)
-    (java-mode . ,hes-java-escape-sequence-re)
-    (js-mode   . ,hes-js-escape-sequence-re)
-    (js2-mode  . ,hes-js-escape-sequence-re)
-    (ruby-mode . ,hes-ruby-escape-sequence-keywords))
+  `((c-mode          . ,hes-c/c++/objc-escape-sequence-re)
+    (c++-mode        . ,hes-c/c++/objc-escape-sequence-re)
+    (objc-mode       . ,hes-c/c++/objc-escape-sequence-re)
+    (java-mode       . ,hes-java-escape-sequence-re)
+    (clojure-mode    . ,hes-java-escape-sequence-re)
+    (js-mode         . ,hes-js-escape-sequence-re)
+    (js2-mode        . ,hes-js-escape-sequence-re)
+    (ruby-mode       . ,hes-ruby-escape-sequence-keywords)
+    (emacs-lisp-mode . ,hes-elisp-escape-sequence-re))
   "Alist of regexps or `font-lock-keywords' elements for major modes."
   :type '(repeat function)
   :set (lambda (symbol value)



reply via email to

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