[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/nix-mode 5a29112764 073/500: Add function for escaped anti
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/nix-mode 5a29112764 073/500: Add function for escaped antiquote. |
Date: |
Sat, 29 Jan 2022 08:26:37 -0500 (EST) |
branch: elpa/nix-mode
commit 5a291127640c967364aeda8c798e17d48c7559f2
Author: Matthew Bauer <mjbauer95@gmail.com>
Commit: Matthew Bauer <mjbauer95@gmail.com>
Add function for escaped antiquote.
This function detects when it's right to ignore or use the ''${ as an
antiquote.
---
nix-mode.el | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/nix-mode.el b/nix-mode.el
index 58148de03f..d995504b4b 100644
--- a/nix-mode.el
+++ b/nix-mode.el
@@ -135,6 +135,26 @@ If a close brace `}' ends an antiquote, the next character
begins a string."
(put-text-property start (1+ start)
'nix-syntax-antiquote t)))))
+(defun nix-syntax-propertize-escaped-antiquote ()
+ "Set syntax properties for escaped antiquote."
+ (let* ((start (match-beginning 0))
+ (context (save-excursion (save-match-data (syntax-ppss start))))
+ (string-type (nth 3 context)))
+
+ ;; treat like multiline when not already in string
+ ;; else ignore
+ (when (not string-type)
+ (put-text-property start (1+ start)
+ 'syntax-table (string-to-syntax "|"))
+
+ (when (string= (buffer-substring (+ 2 start) (+ 4 start)) "${")
+ (put-text-property (+ 2 start) (+ 3 start)
+ 'syntax-table (string-to-syntax "|"))
+ (put-text-property (+ 2 start) (+ 4 start)
+ 'nix-syntax-antiquote t))
+ )
+ ))
+
(defun nix-syntax-propertize (start end)
"Special syntax properties for Nix from START to END."
;; search for multi-line string delimiters
@@ -143,7 +163,7 @@ If a close brace `}' ends an antiquote, the next character
begins a string."
(funcall
(syntax-propertize-rules
("''['\\$\]" ;; ignore ''* characters
- (0 (ignore (lambda () nil))))
+ (0 (ignore (nix-syntax-propertize-escaped-antiquote))))
("''"
(0 (ignore (nix-syntax-propertize-multiline-string))))
("\\${"
- [nongnu] elpa/nix-mode ea95e3c9c6 068/500: Add nix-prettify-mode.el., (continued)
- [nongnu] elpa/nix-mode ea95e3c9c6 068/500: Add nix-prettify-mode.el., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 6eaf2a97d2 069/500: Fixup hanging indent., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode e53d99d840 064/500: Ignore '* chars in syntax propertize., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 9b705381c4 063/500: Fix antiquote highlighting., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 0624820fd3 067/500: Fix org-mode fontification error., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 3338f5997e 056/500: Fix beginning of buffer issue, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 0f01eecdaa 050/500: Make sure everything starts at beginning of line., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 03f462ef34 062/500: Add "+" to hanging indent list., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode ad09b3be7f 066/500: Fix flycheck errors., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 6534f146eb 065/500: Formatting, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 5a29112764 073/500: Add function for escaped antiquote.,
ELPA Syncer <=
- [nongnu] elpa/nix-mode 460cc23161 075/500: Make " be treated as generic | syntax class., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode ff8409c617 079/500: Declare lexical-binding, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 6a9cb7e682 081/500: Add basic REPL via nix-repl, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 836e14fdd4 093/500: Merge pull request #12 from matthewbauer/case-sensitive-searching, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode ea23a301d7 086/500: Fontification.., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode f309e106ef 090/500: Revert "Make " be treated as generic | syntax class.", ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 64d615d628 096/500: Add nix-mode-mmm, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode f968cb98ef 097/500: Add nix-buffer., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode c0502994b5 100/500: Remove nix-mode-reload., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 956280c161 116/500: Refactor nix--antiquote-close, ELPA Syncer, 2022/01/29