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

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

[nongnu] elpa/nix-mode 0f94476b7e 117/500: nix-syntax-match-antiquote: H


From: ELPA Syncer
Subject: [nongnu] elpa/nix-mode 0f94476b7e 117/500: nix-syntax-match-antiquote: Handle case where point has the property
Date: Sat, 29 Jan 2022 08:26:46 -0500 (EST)

branch: elpa/nix-mode
commit 0f94476b7e845eb4dd6e51d87fbfb9846eb990ac
Author: Leon Isenberg <ljli@users.noreply.github.com>
Commit: Leon Isenberg <ljli@users.noreply.github.com>

    nix-syntax-match-antiquote: Handle case where point has the property
---
 nix-mode.el | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/nix-mode.el b/nix-mode.el
index 2d01b9e0c6..a0542586ef 100644
--- a/nix-mode.el
+++ b/nix-mode.el
@@ -28,22 +28,26 @@
 
 (defun nix-syntax-match-antiquote (limit)
   "Find antiquote within a Nix expression up to LIMIT."
-  (let ((pos (next-single-char-property-change (point) 'nix-syntax-antiquote
-                                               nil limit)))
-    (when (and pos (> pos (point)) (< pos (point-max)))
-      (goto-char pos)
-      (let ((char (char-after pos)))
-        (pcase char
-          (`?{
-           (forward-char 1)
-           (set-match-data (list (1- pos) (point)))
-           t)
-          (`?}
-           (forward-char 1)
-           (set-match-data (list pos (point)))
-           t))
-        )
-      )))
+  (unless (> (point) limit)
+    (if (get-text-property (point) 'nix-syntax-antiquote)
+        (progn
+          (set-match-data (list (point) (1+ (point))))
+          (forward-char 1)
+          t)
+      (let ((pos (next-single-char-property-change (point) 
'nix-syntax-antiquote
+                                                   nil limit)))
+        (when (and pos (not (> pos limit)))
+          (goto-char pos)
+          (let ((char (char-after pos)))
+            (pcase char
+              (`?{
+               (forward-char 1)
+               (set-match-data (list (1- pos) (point)))
+               t)
+              (`?}
+               (forward-char 1)
+               (set-match-data (list pos (point)))
+               t))))))))
 
 (defconst nix-keywords
   '("if" "then"



reply via email to

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