Subject: bug#51312: 29.0.50; Indenting vectors with leading spaces errors out

From: martin rudalics <[email-masked]>
Date: Thu, 21 Oct 2021 11:06:23 +0200

> Trying to use the newish space-after-parenthesis syntax errors out when
 > you hit tab on the second line:
 >
 > [ :foo :zot
 >        :bar]
 >
 > forward-sexp: Scan error: "Containing expression ends prematurely", 1, 1

Can you try the attached patch?

Thanks, martin
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -1078,10 +1078,11 @@ calculate-lisp-indent
 		       ;; Handle prefix characters and whitespace
 		       ;; following an open paren.  (Bug#1012)
                        (backward-prefix-chars)
-                       (while (not (or (looking-back "^[ \t]*\\|([ \t]+"
-                                                      (line-beginning-position))
-                                       (and containing-sexp
-                                            (>= (1+ containing-sexp) (point)))))
+                       (while (not (save-excursion
+                                     (skip-chars-backward " \t")
+                                     (or (= (point) (line-beginning-position))
+                                         (and containing-sexp
+                                              (= (point) (1+ containing-sexp))))))
                          (forward-sexp -1)
                          (backward-prefix-chars))
                        (setq calculate-lisp-indent-last-sexp (point)))