mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-10 16:20:17 -08:00
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.
This commit is contained in:
parent
24d06313c4
commit
750f0e2e79
2 changed files with 32 additions and 15 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue