1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-09 07:40:39 -08:00

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.
This commit is contained in:
Noam Postavsky 2018-07-27 19:41:39 -04:00
parent d24c5f26bf
commit 8579105393
2 changed files with 27 additions and 8 deletions

View file

@ -125,6 +125,17 @@ noindent\" 3
#s(foo
bar)\n"))))
(ert-deftest indent-sexp-cant-go ()
"`indent-sexp' shouldn't error before a sexp."
;; See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31984#32.
(with-temp-buffer
(emacs-lisp-mode)
(insert "(())")
(goto-char (1+ (point-min)))
;; Paredit calls `indent-sexp' from this position.
(indent-sexp)
(should (equal (buffer-string) "(())"))))
(ert-deftest lisp-indent-region ()
"Test basics of `lisp-indent-region'."
(with-temp-buffer