[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/nix-mode 795cc0c4c5 350/500: Handle angle paths correctly
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/nix-mode 795cc0c4c5 350/500: Handle angle paths correctly |
Date: |
Sat, 29 Jan 2022 08:27:20 -0500 (EST) |
branch: elpa/nix-mode
commit 795cc0c4c51d1697ceb3f714ec4b3a5c235cf0be
Author: Jakub Piecuch <j.piecuch96@gmail.com>
Commit: Jakub Piecuch <j.piecuch96@gmail.com>
Handle angle paths correctly
---
nix-mode.el | 36 ++++++++++++++++++++++++++++++++----
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/nix-mode.el b/nix-mode.el
index 7e7a952670..96d3401370 100644
--- a/nix-mode.el
+++ b/nix-mode.el
@@ -527,21 +527,48 @@ STRING-TYPE type of string based off of Emacs syntax
table types"
(defconst nix-smie--path-chars "a-zA-Z0-9-+_.:/~")
-(defun nix-smie--skip-path (how)
+(defun nix-smie--skip-angle-path-forward ()
+ "Skip forward a path enclosed in angle brackets, e.g <nixpkgs>"
+ (let ((start (point)))
+ (when (eq (char-after) ?<)
+ (forward-char)
+ (if (and (nix-smie--skip-path 'forward t)
+ (eq (char-after) ?>))
+ (progn
+ (forward-char)
+ (buffer-substring-no-properties start (point)))
+ (ignore (goto-char start))))))
+
+(defun nix-smie--skip-angle-path-backward ()
+ "Skip backward a path enclosed in angle brackets, e.g <nixpkgs>"
+ (let ((start (point)))
+ (when (eq (char-before) ?>)
+ (backward-char)
+ (if (and (nix-smie--skip-path 'backward t)
+ (eq (char-before) ?<))
+ (progn
+ (backward-char)
+ (buffer-substring-no-properties start (point)))
+ (ignore (goto-char start))))))
+
+(defun nix-smie--skip-path (how &optional no-sep-check)
"Skip path related characters."
(let ((start (point)))
(pcase-exhaustive how
('forward (skip-chars-forward nix-smie--path-chars))
('backward (skip-chars-backward nix-smie--path-chars)))
(let ((sub (buffer-substring-no-properties start (point))))
- (if (string-match-p "/" sub)
+ (if (or (and no-sep-check
+ (< 0 (length sub)))
+ (string-match-p "/" sub))
sub
(ignore (goto-char start))))))
(defun nix-smie--forward-token-1 ()
"Move forward one token."
(forward-comment (point-max))
- (or (nix-smie--skip-path 'forward)
+ (or (nix-smie--skip-angle-path-forward)
+ (nix-smie--skip-path 'forward)
(buffer-substring-no-properties
(point)
(progn
@@ -562,7 +589,8 @@ STRING-TYPE type of string based off of Emacs syntax table
types"
(defun nix-smie--backward-token-1 ()
"Move backward one token."
(forward-comment (- (point)))
- (or (nix-smie--skip-path 'backward)
+ (or (nix-smie--skip-angle-path-backward)
+ (nix-smie--skip-path 'backward)
(buffer-substring-no-properties
(point)
(progn
- [nongnu] elpa/nix-mode 91834848b4 320/500: Generate AUTHORS.md, (continued)
- [nongnu] elpa/nix-mode 91834848b4 320/500: Generate AUTHORS.md, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 0bab799a87 325/500: Add failing test that checks indentation of closing parens., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode dd5f937a49 331/500: Change the description of a couple of tests., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 10ac680cd6 332/500: Merge pull request #80 from j-piecuch/smie-tweaks, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 907336cd0b 337/500: Silence byte compiler warnings in nix-shell, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 2f4bd0f09c 336/500: Release 1.4.1, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 00750803d9 356/500: Don't freeze full executable paths at load time, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 3248864b56 348/500: Add failing tests that check for correct lexing of angle paths., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 8118a807a7 346/500: Handle more edge cases in keywords, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode c2725000ab 349/500: Use pcase-exhaustive instead of pcase in nix-smie--skip-path, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 795cc0c4c5 350/500: Handle angle paths correctly,
ELPA Syncer <=
- [nongnu] elpa/nix-mode a0fc6db303 365/500: Fix testcase file name., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode f77ae8fb54 380/500: Add more builtins, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode e4e604ae3a 389/500: Release 1.4.4, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 228f9f9d39 387/500: Release 1.4.3, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode bdfe3b3ae3 391/500: Fix nix-get-completions, add to nix-repl-mode, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 70af0efc9f 076/500: Fix antiquote closing brace., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 59e9ca0abd 084/500: Improve fontification, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 68793d91c5 107/500: Add require 'cl for case statements., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 2221a09aea 108/500: Require 'cl for "case"., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode e4bc711d81 094/500: Add some more modes., ELPA Syncer, 2022/01/29