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

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

[nongnu] elpa/nix-mode 9b705381c4 063/500: Fix antiquote highlighting.


From: ELPA Syncer
Subject: [nongnu] elpa/nix-mode 9b705381c4 063/500: Fix antiquote highlighting.
Date: Sat, 29 Jan 2022 08:26:36 -0500 (EST)

branch: elpa/nix-mode
commit 9b705381c40ef1ac28a929b7019659f3d996494a
Author: Matthew Bauer <mjbauer95@gmail.com>
Commit: Matthew Bauer <mjbauer95@gmail.com>

    Fix antiquote highlighting.
    
    Fixes #3.
---
 nix-mode.el | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/nix-mode.el b/nix-mode.el
index 9b2576a2c6..966ce793ff 100644
--- a/nix-mode.el
+++ b/nix-mode.el
@@ -107,11 +107,16 @@
 
 (defun nix-syntax-propertize-antiquote ()
   "Set syntax properties for an antiquote mark."
-  (let* ((start (match-beginning 0)))
-    (put-text-property start (1+ start)
-                       'syntax-table (string-to-syntax "|"))
-    (put-text-property start (+ start 2)
-                       'nix-syntax-antiquote t)))
+  (let* ((start (match-beginning 0))
+         (context (save-excursion (save-match-data (syntax-ppss start))))
+         (string-type (nth 3 context)))
+
+    ;; only add antiquote when we're already in a string
+    (when string-type
+      (put-text-property start (1+ start)
+                        'syntax-table (string-to-syntax "|"))
+      (put-text-property start (+ start 2)
+                       'nix-syntax-antiquote t))))
 
 (defun nix-syntax-propertize-close-brace ()
   "Set syntax properties for close braces.



reply via email to

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