emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/nix-mode ff0a773d31 297/500: fix-issue-72: Check the corre


From: ELPA Syncer
Subject: [nongnu] elpa/nix-mode ff0a773d31 297/500: fix-issue-72: Check the correct element from syntax-ppss
Date: Sat, 29 Jan 2022 08:27:15 -0500 (EST)

branch: elpa/nix-mode
commit ff0a773d31123620c77bb501987a8f7968063f84
Author: Elis Hirwing <elis@hirwing.se>
Commit: Elis Hirwing <elis@hirwing.se>

    fix-issue-72: Check the correct element from syntax-ppss
    
    This is kinda a semi-revert from a small change in
    bb602e160fa5bb8ae15b113ebf308f0fb30b3aa9 where the code:
    
    "(nth 4 (syntax-ppss))"
    
    was replaced with a function that did:
    
    "(nth 3 (syntax-ppss))"
---
 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
+  '';
+}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]