From 2e5f87b345d349dc6657f8034102a842d0685232 Mon Sep 17 00:00:00 2001 From: akater Date: Thu, 30 Sep 2021 13:37:59 +0000 Subject: [PATCH] Fix other regressions in cl-flet indentation * lisp/emacs-lisp/lisp-mode.el (lisp--local-defform-body-p): Fix indentation regression introduced by 38037e04cb05cb1f2b604f0b1602d36b0bcf6985 (bug#9622), namely don't fail in unreadable (incl. unbalanced) sexps. --- lisp/emacs-lisp/lisp-mode.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index cd054801bc..57196dfec4 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -1124,9 +1124,13 @@ defun lisp--local-defform-body-p (state) (when second-order-parent (save-excursion (goto-char (1+ second-order-parent)) - (and (memq (read (current-buffer)) - '( cl-flet cl-labels cl-macrolet cl-flet* - cl-symbol-macrolet)) + (and (when-let ((head (ignore-errors + ;; FIXME: This does not distinguish + ;; between reading nil and a read error. + ;; We don't care but still, better fix this. + (read (current-buffer))))) + (memq head '( cl-flet cl-labels cl-macrolet cl-flet* + cl-symbol-macrolet))) ;; Now we must check that we are ;; in the second element of the flet-like form. ;; It would be easier if `parse-partial-sexp' also recorded -- 2.32.0