Don't error when indenting malformed Lisp (Bug#30891)
* lisp/emacs-lisp/lisp-mode.el (lisp-indent-calc-next): If we run out of indent stack, reset the parse state.
This commit is contained in:
parent
c3adbc88a0
commit
92de44fa1f
1 changed files with 4 additions and 0 deletions
|
@ -827,6 +827,10 @@ by more than one line to cross a string literal."
|
||||||
(prog1
|
(prog1
|
||||||
(let (indent)
|
(let (indent)
|
||||||
(cond ((= (forward-line 1) 1) nil)
|
(cond ((= (forward-line 1) 1) nil)
|
||||||
|
;; Negative depth, probably some kind of syntax error.
|
||||||
|
((null indent-stack)
|
||||||
|
;; Reset state.
|
||||||
|
(setq ppss (parse-partial-sexp (point) (point))))
|
||||||
((car indent-stack))
|
((car indent-stack))
|
||||||
((integerp (setq indent (calculate-lisp-indent ppss)))
|
((integerp (setq indent (calculate-lisp-indent ppss)))
|
||||||
(setf (car indent-stack) indent))
|
(setf (car indent-stack) indent))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue