branch: elpa/nix-mode
commit 9ebf7389eb272e4ce1874350092d839e57a95fc8
Merge: 80a1e96c71 ff0a773d31
Author: Elis Hirwing <[email protected]>
Commit: Elis Hirwing <[email protected]>
Merge branch 'etu-fix-issue-72'
---
nix-mode.el | 2 +-
tests/nix-mode-tests.el | 6 ++++++
tests/testcases/issue-72.nix | 6 ++++++
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/nix-mode.el b/nix-mode.el
index df664a36a3..707723f3ca 100644
--- a/nix-mode.el
+++ b/nix-mode.el
@@ -519,7 +519,7 @@ STRING-TYPE type of string based off of Emacs syntax table
types"
(defun nix-is-comment-p ()
"Whether we are in a comment."
- (nth 3 (syntax-ppss)))
+ (nth 4 (syntax-ppss)))
(defun nix-is-string-p ()
"Whether we are in a string."
diff --git a/tests/nix-mode-tests.el b/tests/nix-mode-tests.el
index a73a90c655..700b8e9d44 100644
--- a/tests/nix-mode-tests.el
+++ b/tests/nix-mode-tests.el
@@ -118,5 +118,11 @@ Related issue: https://github.com/NixOS/nix-mode/issues/69"
Related issue: https://github.com/NixOS/nix-mode/issues/69"
(with-nix-mode-test ("issue-60.2.nix" :indent t)))
+(ert-deftest nix-mode-test-indent-issue-72 ()
+ "Proper indentation of strings in a multi-line string.
+
+Related issue: https://github.com/NixOS/nix-mode/issues/72"
+ (with-nix-mode-test ("issue-72.nix" :indent t)))
+
(provide 'nix-mode-tests)
;;; nix-mode-tests.el ends here
diff --git a/tests/testcases/issue-72.nix b/tests/testcases/issue-72.nix
new file mode 100644
index 0000000000..94b11c487b
--- /dev/null
+++ b/tests/testcases/issue-72.nix
@@ -0,0 +1,6 @@
+# Test to make sure nix-mode indents the contents of the string two spaces.
+{
+ foo = ''
+ bar
+ '';
+}