]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't error when indenting malformed Lisp (Bug#30891)
authorNoam Postavsky <npostavs@gmail.com>
Sun, 18 Mar 2018 01:14:11 +0000 (21:14 -0400)
committerNoam Postavsky <npostavs@gmail.com>
Thu, 25 Oct 2018 21:55:49 +0000 (17:55 -0400)
* lisp/emacs-lisp/lisp-mode.el (lisp-indent-calc-next): If we run out
of indent stack, reset the parse state.

lisp/emacs-lisp/lisp-mode.el

index 205c810b978a8f980bfaa130390394fe463cb095..13ad06e4aee88bf1bb950261190a3bc0dec60bb1 100644 (file)
@@ -827,6 +827,10 @@ by more than one line to cross a string literal."
     (prog1
         (let (indent)
           (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))
                 ((integerp (setq indent (calculate-lisp-indent ppss)))
                  (setf (car indent-stack) indent))