Skip to content

Commit

Permalink
Don’t skip over > in angle-path
Browse files Browse the repository at this point in the history
Fixes #94
  • Loading branch information
matthewbauer committed May 10, 2020
1 parent ddf0917 commit 9242165
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
10 changes: 5 additions & 5 deletions nix-mode.el
Expand Up @@ -418,7 +418,7 @@ STRING-TYPE type of string based off of Emacs syntax table types"
(right " -bseqskip- ") (right " -bseqskip- ")
(left " -fseqskip- ")))))) (left " -fseqskip- "))))))


(defconst nix-smie--symbol-chars ":->|&=!</-+*?,;!") (defconst nix-smie--symbol-chars "[:->|&=!</-+*?,;!]")


(defconst nix-smie--infix-symbols-re (defconst nix-smie--infix-symbols-re
(regexp-opt '(":" "->" "||" "&&" "==" "!=" "<" "<=" ">" ">=" (regexp-opt '(":" "->" "||" "&&" "==" "!=" "<" "<=" ">" ">="
Expand Down Expand Up @@ -573,8 +573,8 @@ STRING-TYPE type of string based off of Emacs syntax table types"
(point) (point)
(progn (progn
(or (/= 0 (skip-syntax-forward "'w_")) (or (/= 0 (skip-syntax-forward "'w_"))
(/= 0 (skip-chars-forward nix-smie--symbol-chars)) (when (looking-at nix-smie--symbol-chars) (forward-char) t)
(skip-syntax-forward ".'")) (skip-syntax-forward "'"))
(point))))) (point)))))


(defun nix-smie--forward-token () (defun nix-smie--forward-token ()
Expand All @@ -595,8 +595,8 @@ STRING-TYPE type of string based off of Emacs syntax table types"
(point) (point)
(progn (progn
(or (/= 0 (skip-syntax-backward "'w_")) (or (/= 0 (skip-syntax-backward "'w_"))
(/= 0 (skip-chars-backward nix-smie--symbol-chars)) (when (looking-back nix-smie--symbol-chars) (backward-char) t)
(skip-syntax-backward ".'")) (skip-syntax-backward "'"))
(point))))) (point)))))


(defun nix-smie--backward-token () (defun nix-smie--backward-token ()
Expand Down
6 changes: 6 additions & 0 deletions tests/nix-mode-tests.el
Expand Up @@ -227,6 +227,12 @@ Related issue: https://github.com/NixOS/nix-mode/issues/72"
"Proper indentation of strings in a multi-line string." "Proper indentation of strings in a multi-line string."
(with-nix-mode-test ("issue-78.nix" :indent 'smie-indent-line))) (with-nix-mode-test ("issue-78.nix" :indent 'smie-indent-line)))


(ert-deftest nix-mode-test-indent-issue-94 ()
"Proper indentation of attrsets inside of lists inside of attrsets.
Related issue: https://github.com/NixOS/nix-mode/issues/94"
(with-nix-mode-test ("issue-60.1.nix" :indent 'smie-indent-line)))

(ert-deftest nix-mode-test-indent-lambdas-smie () (ert-deftest nix-mode-test-indent-lambdas-smie ()
"Proper indentation of function bodies." "Proper indentation of function bodies."
(with-nix-mode-test ("smie-lambdas.nix" :indent 'smie-indent-line))) (with-nix-mode-test ("smie-lambdas.nix" :indent 'smie-indent-line)))
Expand Down
6 changes: 6 additions & 0 deletions tests/testcases/issue-94.nix
@@ -0,0 +1,6 @@
let
nixpkgs = <nixpkgs>;
wrongIndentedLine = true;
in {
a = "b";
}

0 comments on commit 9242165

Please sign in to comment.