[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/nix-mode 956280c161 116/500: Refactor nix--antiquote-close
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/nix-mode 956280c161 116/500: Refactor nix--antiquote-close |
Date: |
Sat, 29 Jan 2022 08:26:45 -0500 (EST) |
branch: elpa/nix-mode
commit 956280c161d2abbb5dac7f9c35c5ca4cbcfd4a78
Author: Leon Isenberg <ljli@users.noreply.github.com>
Commit: Leon Isenberg <ljli@users.noreply.github.com>
Refactor nix--antiquote-close
---
nix-mode.el | 60 +++++++++++++++++++++++-------------------------------------
1 file changed, 23 insertions(+), 37 deletions(-)
diff --git a/nix-mode.el b/nix-mode.el
index 5535a899a1..2d01b9e0c6 100644
--- a/nix-mode.el
+++ b/nix-mode.el
@@ -16,8 +16,6 @@
;;; Code:
-(require 'cl)
-
;; Emacs 24.2 compatability
(unless (fboundp 'setq-local)
(defmacro setq-local (var val)
@@ -196,45 +194,33 @@
(unless (nix--get-string-type ps)
(let ((string-type (nix--open-brace-string-type ps)))
(when string-type
- (put-text-property start (+ 2 start)
+ (put-text-property start (1+ start)
'nix-string-type string-type)
(put-text-property start (1+ start)
'nix-syntax-antiquote t)
(let ((ahead (buffer-substring (1+ start) (min (point-max) (+ 5
start)))))
- (case string-type
- (?\" (cond
- ((string-match-p "^\\\\\"" ahead)
- (put-text-property (1+ start) (+ 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)
- 'syntax-table (string-to-syntax "|"))
- (goto-char (+ 4 start)))
- ((string-match-p "^''\\${" ahead)
- (put-text-property (1+ start) (+ 2 start)
- 'syntax-table (string-to-syntax "|"))
- (goto-char (+ 5 start)))
- ((string-match-p "^''\\\\[nrt]" ahead)
- (put-text-property (1+ start) (+ 2 start)
- 'syntax-table (string-to-syntax "|"))
- (goto-char (+ 5 start)))
- ((string-match-p "^''" ahead)
- (goto-char (+ 3 start)))
- (t (put-text-property (1+ start) (+ 2 start)
- 'syntax-table (string-to-syntax "|"))
- (goto-char (+ 2 start))))))))))))
+ (pcase string-type
+ (`?\" (cond
+ ((or (string-match "^\\\\\"" ahead)
+ (string-match "^\\\\\\${" ahead))
+ (nix--mark-string (1+ start) string-type)
+ (goto-char (match-end 0)))
+ ((string-match-p "^\"" ahead)
+ (goto-char (+ 2 start)))
+ ((< (1+ start) (point-max))
+ (nix--mark-string (1+ start) string-type)
+ (goto-char (+ 2 start)))))
+ (`?\' (cond
+ ((or (string-match "^'''" ahead)
+ (string-match "^''\\${" ahead)
+ (string-match "^''\\\\[nrt]" ahead))
+ (nix--mark-string (1+ start) string-type)
+ (goto-char (match-end 0)))
+ ((string-match-p "^''" ahead)
+ (goto-char (+ 3 start)))
+ ((< (1+ start) (point-max))
+ (nix--mark-string (1+ start) string-type)
+ (goto-char (+ 2 start))))))))))))
(defun nix-syntax-propertize (start end)
"Special syntax properties for Nix from START to END."
- [nongnu] elpa/nix-mode 5a29112764 073/500: Add function for escaped antiquote., (continued)
- [nongnu] elpa/nix-mode 5a29112764 073/500: Add function for escaped antiquote., ELPA Syncer, 2022/01/29
- [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 <=
- [nongnu] elpa/nix-mode de02e17924 135/500: Fix fontification of "}${" in some contexts, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 0b19f975cd 143/500: Merge pull request #28 from pvmart/fix-nix-mmm, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 719482b701 148/500: Update customizations for Nix related modes., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode b3c6560f6d 166/500: Fix typo: rustfmt -> nixfmt, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 038dcf7b1b 147/500: Cleanup, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 3edda90cfd 146/500: Remove nix-flycheck, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode a967408f64 188/500: Don’t error when nix-shebang fails., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 05d7c828b3 187/500: Fix nix-company and mmm-mode loading., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 281bfc1abf 176/500: Cleanup font-locks again, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 407051ad31 175/500: Add font-lock-tests.el file, ELPA Syncer, 2022/01/29