branch: elpa/nix-mode
commit 7fbc65ae68afb1091ac3faa29833be95976dc2f1
Merge: c0502994b5 8d2a304865
Author: Matthew Justin Bauer <[email protected]>
Commit: GitHub <[email protected]>

    Merge pull request #16 from ljli/fontification-improvs
    
    Fontification: smoked out corner cases
---
 nix-mode.el | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/nix-mode.el b/nix-mode.el
index 654d649ff5..ee4bf4e480 100644
--- a/nix-mode.el
+++ b/nix-mode.el
@@ -174,10 +174,21 @@
                              'nix-syntax-antiquote t)
           (let ((ahead (buffer-substring (1+ start) (min (point-max) (+ 5 
start)))))
             (case string-type
-              (?\" (unless (string-match-p "^\"" ahead)
+              (?\" (cond
+                    ((string-match-p "^\\\\\"" ahead)
                      (put-text-property (1+ start) (+ 2 start)
-                                        'syntax-table (string-to-syntax "|")))
-                   (goto-char (+ 2 start)))
+                                        'syntax-table (string-to-syntax "|"))
+                     (goto-char (+ 3 start)))
+                    ((string-match-p "^\\\\\\${" ahead)
+                     (put-text-property (1+ start) (+ 2 start)
+                                        'syntax-table (string-to-syntax "|"))
+                     (goto-char (+ 4 start)))
+                    ((string-match-p "^\"" ahead)
+                     (goto-char (+ 2 start)))
+                    (t
+                     (put-text-property (1+ start) (+ 2 start)
+                                        'syntax-table (string-to-syntax "|"))
+                     (goto-char (+ 2 start)))))
               (?\' (cond
                     ((string-match-p "^'''" ahead)
                      (put-text-property (1+ start) (+ 2 start)
@@ -187,7 +198,7 @@
                      (put-text-property (1+ start) (+ 2 start)
                                         'syntax-table (string-to-syntax "|"))
                      (goto-char (+ 5 start)))
-                    ((string-match-p "^''\\[nrt]" ahead)
+                    ((string-match-p "^''\\\\[nrt]" ahead)
                      (put-text-property (1+ start) (+ 2 start)
                                         'syntax-table (string-to-syntax "|"))
                      (goto-char (+ 5 start)))

Reply via email to