diff options
author | Noam Postavsky <npostavs@gmail.com> | 2017-05-11 18:12:40 -0400 |
---|---|---|
committer | Noam Postavsky <npostavs@gmail.com> | 2017-05-15 22:58:17 -0400 |
commit | 750f0e2e79e1bdc3246b07aa3219cab34ebde6e7 (patch) | |
tree | 9dbb72248eb3843359cc1ad6d475d53112ddf3c2 /test/lisp/emacs-lisp | |
parent | 24d06313c4f205061fb74c9665d5819a05362636 (diff) | |
download | emacs-750f0e2e79e1bdc3246b07aa3219cab34ebde6e7.tar.gz |
Make sure indent-sexp stops at end of sexp (Bug#26878)
* lisp/emacs-lisp/lisp-mode.el (indent-sexp): Check endpos before
indenting.
* test/lisp/emacs-lisp/lisp-mode-tests.el (indent-sexp-stop): New
test.
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r-- | test/lisp/emacs-lisp/lisp-mode-tests.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el b/test/lisp/emacs-lisp/lisp-mode-tests.el index 1f78eb30105..f2fe7a6cf41 100644 --- a/test/lisp/emacs-lisp/lisp-mode-tests.el +++ b/test/lisp/emacs-lisp/lisp-mode-tests.el @@ -99,6 +99,20 @@ noindent\" 3 (indent-sexp) (should (equal (buffer-string) correct))))) +(ert-deftest indent-sexp-stop () + "Make sure `indent-sexp' stops at the end of the sexp." + ;; See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26878. + (with-temp-buffer + (emacs-lisp-mode) + (insert "(a ()\n)") + (let ((original (buffer-string))) + (search-backward "a ") + (goto-char (match-end 0)) + (indent-sexp) + ;; The final paren should not be indented, because the sexp + ;; we're indenting ends on the previous line. + (should (equal (buffer-string) original))))) + (ert-deftest lisp-indent-region () "Test basics of `lisp-indent-region'." (with-temp-buffer |