Created
July 15, 2016 22:20
-
-
Save oakmac/4adefa54f03b1439f34e4f98cb0ecfa9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/parinferlib.el b/parinferlib.el | |
index f5ddd7d..fa694fb 100644 | |
--- a/parinferlib.el | |
+++ b/parinferlib.el | |
@@ -627,15 +627,14 @@ | |
(defun parinferlib--init-indent (result) | |
(let ((mode (gethash :mode result)) | |
(in-str? (gethash :isInStr result))) | |
- (case mode | |
- ((:indent) | |
- ;; length of list > 0 means the same as the list not being null | |
- (puthash :trackingIndent (and (gethash :parenStack result) | |
- (not in-str?)) | |
- result) | |
- (parinferlib--init-preview-cursor-scope result)) | |
- ((:paren) | |
- (puthash :trackingIndent (not in-str?) result))))) | |
+ (when (equal :indent mode) | |
+ ;; length of list > 0 means the same as the list not being null | |
+ (puthash :trackingIndent (and (gethash :parenStack result) | |
+ (not in-str?)) | |
+ result) | |
+ (parinferlib--init-preview-cursor-scope result)) | |
+ (when (equal :paren mode) | |
+ (puthash :trackingIndent (not in-str?) result)))) | |
(defun parinferlib--set-tab-stops (result) | |
(let ((cursor-line (gethash :cursorLine result)) | |
diff --git a/test.el b/test.el | |
index fcd52cd..553c262 100644 | |
--- a/test.el | |
+++ b/test.el | |
@@ -60,6 +60,7 @@ | |
(let* ((mode-string (if (equal :indent mode) "Indent Mode" "Paren Mode")) | |
(in (plist-get test :in)) | |
(out (plist-get test :out)) | |
+ (error-expected? (plist-get out :error)) | |
(test-id (number-to-string (plist-get in :fileLineNo))) | |
(in-text (string-join (plist-get in :lines))) | |
(expected-text (string-join (plist-get out :lines))) | |
@@ -91,7 +92,8 @@ | |
;; cross-mode preservation | |
(when (and (not cursor-x) | |
(not cursor-line) | |
- (not cursor-dx)) | |
+ (not cursor-dx) | |
+ (not error-expected?)) | |
(let* ((result-3 (if (equal :indent mode) | |
(parinferlib-paren-mode out-text-1 nil nil nil) | |
(parinferlib-indent-mode out-text-1 nil nil nil))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment