]> git.eshelyaron.com Git - emacs.git/commit
Fix lisp-indent-region and indent-sexp (Bug#26619)
authorNoam Postavsky <npostavs@gmail.com>
Sun, 23 Apr 2017 14:43:05 +0000 (10:43 -0400)
committerNoam Postavsky <npostavs@gmail.com>
Wed, 10 May 2017 00:50:19 +0000 (20:50 -0400)
commite7b6751c0a74f24c14cd207d57a4e1a95f409256
tree14f60933c9d78aabf42ba79abd911f9ef3e3d373
parent17e540aa428c5392f7a9b4c1f7495bac8a8fe5da
Fix lisp-indent-region and indent-sexp (Bug#26619)

The new lisp-indent-region introduced in 2017-04-22 "Add new
`lisp-indent-region' that doesn't reparse the code." is broken because
it doesn't save the calculated indent amounts for already seen sexp
depths.  Fix this by unifying the indent-sexp and lisp-indent-region
code.  Furthermore, only preserve position 2 of the running parse
when the depth doesn't change.
* lisp/emacs-lisp/lisp-mode.el (lisp-ppss): Use an OLDSTATE that
corresponds with the start point when calling parse-partial-sexp.
(lisp-indent-state): New struct.
(lisp-indent-calc-next): New function, extracted from indent-sexp.
(indent-sexp, lisp-indent-region): Use it.
(lisp-indent-line): Take indentation, instead of parse state.
* test/lisp/emacs-lisp/lisp-mode-tests.el
(lisp-mode-tests--correctly-indented-sexp): New constant.
(lisp-indent-region, lisp-indent-region-defun-with-docstring):
(lisp-indent-region-open-paren, lisp-indent-region-in-sexp): New
tests.
lisp/emacs-lisp/lisp-mode.el
test/lisp/emacs-lisp/lisp-mode-tests.el