diff options
| author | Noam Postavsky | 2018-03-17 21:14:11 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2018-10-25 17:55:49 -0400 |
| commit | 92de44fa1fdeda74a9b8254f968829df4c957da0 (patch) | |
| tree | 2c6c352dbc0384b58f9ad927ad195a023b9492d4 | |
| parent | c3adbc88a00f2c8fa773d46bfcf4571c9ebde8fb (diff) | |
| download | emacs-92de44fa1fdeda74a9b8254f968829df4c957da0.tar.gz emacs-92de44fa1fdeda74a9b8254f968829df4c957da0.zip | |
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.
| -rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 205c810b978..13ad06e4aee 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el | |||
| @@ -827,6 +827,10 @@ by more than one line to cross a string literal." | |||
| 827 | (prog1 | 827 | (prog1 |
| 828 | (let (indent) | 828 | (let (indent) |
| 829 | (cond ((= (forward-line 1) 1) nil) | 829 | (cond ((= (forward-line 1) 1) nil) |
| 830 | ;; Negative depth, probably some kind of syntax error. | ||
| 831 | ((null indent-stack) | ||
| 832 | ;; Reset state. | ||
| 833 | (setq ppss (parse-partial-sexp (point) (point)))) | ||
| 830 | ((car indent-stack)) | 834 | ((car indent-stack)) |
| 831 | ((integerp (setq indent (calculate-lisp-indent ppss))) | 835 | ((integerp (setq indent (calculate-lisp-indent ppss))) |
| 832 | (setf (car indent-stack) indent)) | 836 | (setf (car indent-stack) indent)) |