emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 92de44f: Don't error when indenting malformed Lis


From: Noam Postavsky
Subject: [Emacs-diffs] emacs-26 92de44f: Don't error when indenting malformed Lisp (Bug#30891)
Date: Thu, 25 Oct 2018 18:03:28 -0400 (EDT)

branch: emacs-26
commit 92de44fa1fdeda74a9b8254f968829df4c957da0
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    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.
---
 lisp/emacs-lisp/lisp-mode.el | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 205c810..13ad06e 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."
     (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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]