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

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

[elpa] master 6bc14c4 16/27: Beautify hes-ruby-escape-sequence-keywords


From: Dmitry Gutov
Subject: [elpa] master 6bc14c4 16/27: Beautify hes-ruby-escape-sequence-keywords
Date: Sat, 29 Oct 2016 00:04:18 +0000 (UTC)

branch: master
commit 6bc14c47f8646bac5bcaafce32baff5a0527e1b1
Author: Pavel Matcula <address@hidden>
Commit: Pavel Matcula <address@hidden>

    Beautify hes-ruby-escape-sequence-keywords
---
 highlight-escape-sequences.el |   29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/highlight-escape-sequences.el b/highlight-escape-sequences.el
index 98cf84c..8f50fc0 100644
--- a/highlight-escape-sequences.el
+++ b/highlight-escape-sequences.el
@@ -138,24 +138,17 @@ Currently doesn't handle \\C-, \\M-, etc.")
 
 (defconst hes-ruby-escape-sequence-keywords
   `((,hes-ruby-escape-sequence-re
-     (1 (let* ((state (syntax-ppss))
-              (term (nth 3 state)))
-         (when (or (and (eq term ?')
-                        (member (match-string 2) '("\\" "'")))
-                   (if (fboundp 'ruby-syntax-expansion-allowed-p)
-                       (ruby-syntax-expansion-allowed-p state)
-                     (memq term '(?\" ?/ ?\n ?` t))))
-           'hes-escape-backslash-face))
-       prepend)
-     (2 (let* ((state (syntax-ppss))
-              (term (nth 3 state)))
-         (when (or (and (eq term ?')
-                        (member (match-string 2) '("\\" "'")))
-                   (if (fboundp 'ruby-syntax-expansion-allowed-p)
-                       (ruby-syntax-expansion-allowed-p state)
-                     (memq term '(?\" ?/ ?\n ?` t))))
-           'hes-escape-sequence-face))
-       prepend))))
+     (0 (let* ((state (syntax-ppss))
+               (term (nth 3 state)))
+          (when (or (and (eq term ?')
+                         (member (match-string 2) '("\\" "'")))
+                    (if (fboundp 'ruby-syntax-expansion-allowed-p)
+                        (ruby-syntax-expansion-allowed-p state)
+                      (memq term '(?\" ?/ ?\n ?` t))))
+            (add-face-text-property (match-beginning 1) (match-end 1) 
'hes-escape-backslash-face)
+            (add-face-text-property (match-beginning 2) (match-end 2) 
'hes-escape-sequence-face)
+            nil))
+        prepend))))
 
 (defun hes-make-simple-escape-sequence-keywords(re)
   `((,re



reply via email to

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