aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNoam Postavsky2018-07-27 19:41:39 -0400
committerNoam Postavsky2018-07-27 19:41:39 -0400
commit857910539313c0f2d89fe5626a41f1abe6c33ca7 (patch)
tree7c4a9b8184cd09d842962fe9dcbec07651611766 /test
parentd24c5f26bf6c12bda614f90ba3345d710482005a (diff)
downloademacs-857910539313c0f2d89fe5626a41f1abe6c33ca7.tar.gz
emacs-857910539313c0f2d89fe5626a41f1abe6c33ca7.zip
Don't fail to indent-sexp before a full sexp (Bug#31984)
* lisp/emacs-lisp/lisp-mode.el (indent-sexp): Only signal error if the initial forward-sexp fails. Suppress scan-error forn any of the forward-sexp calls after that. * test/lisp/emacs-lisp/lisp-mode-tests.el (indent-sexp-cant-go): New test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/emacs-lisp/lisp-mode-tests.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el b/test/lisp/emacs-lisp/lisp-mode-tests.el
index 0b052e9fc30..30f606d3816 100644
--- a/test/lisp/emacs-lisp/lisp-mode-tests.el
+++ b/test/lisp/emacs-lisp/lisp-mode-tests.el
@@ -125,6 +125,17 @@ noindent\" 3
125#s(foo 125#s(foo
126 bar)\n")))) 126 bar)\n"))))
127 127
128(ert-deftest indent-sexp-cant-go ()
129 "`indent-sexp' shouldn't error before a sexp."
130 ;; See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31984#32.
131 (with-temp-buffer
132 (emacs-lisp-mode)
133 (insert "(())")
134 (goto-char (1+ (point-min)))
135 ;; Paredit calls `indent-sexp' from this position.
136 (indent-sexp)
137 (should (equal (buffer-string) "(())"))))
138
128(ert-deftest lisp-indent-region () 139(ert-deftest lisp-indent-region ()
129 "Test basics of `lisp-indent-region'." 140 "Test basics of `lisp-indent-region'."
130 (with-temp-buffer 141 (with-temp-buffer