aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNoam Postavsky2017-05-11 18:12:40 -0400
committerNoam Postavsky2017-05-15 22:58:17 -0400
commit750f0e2e79e1bdc3246b07aa3219cab34ebde6e7 (patch)
tree9dbb72248eb3843359cc1ad6d475d53112ddf3c2 /test
parent24d06313c4f205061fb74c9665d5819a05362636 (diff)
downloademacs-750f0e2e79e1bdc3246b07aa3219cab34ebde6e7.tar.gz
emacs-750f0e2e79e1bdc3246b07aa3219cab34ebde6e7.zip
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')
-rw-r--r--test/lisp/emacs-lisp/lisp-mode-tests.el14
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
99 (indent-sexp) 99 (indent-sexp)
100 (should (equal (buffer-string) correct))))) 100 (should (equal (buffer-string) correct)))))
101 101
102(ert-deftest indent-sexp-stop ()
103 "Make sure `indent-sexp' stops at the end of the sexp."
104 ;; See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26878.
105 (with-temp-buffer
106 (emacs-lisp-mode)
107 (insert "(a ()\n)")
108 (let ((original (buffer-string)))
109 (search-backward "a ")
110 (goto-char (match-end 0))
111 (indent-sexp)
112 ;; The final paren should not be indented, because the sexp
113 ;; we're indenting ends on the previous line.
114 (should (equal (buffer-string) original)))))
115
102(ert-deftest lisp-indent-region () 116(ert-deftest lisp-indent-region ()
103 "Test basics of `lisp-indent-region'." 117 "Test basics of `lisp-indent-region'."
104 (with-temp-buffer 118 (with-temp-buffer