]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/lisp-mode.el (lisp-tidy-sexp): Fix infloop.
authorEshel Yaron <me@eshelyaron.com>
Tue, 25 Feb 2025 19:38:12 +0000 (20:38 +0100)
committerEshel Yaron <me@eshelyaron.com>
Tue, 25 Feb 2025 19:38:12 +0000 (20:38 +0100)
lisp/emacs-lisp/lisp-mode.el

index 76cb059a2a70749c9eb486ef600ed28459507952..8ae1e7f4e0471970bd6bdc7aa357f3922fd86163 100644 (file)
@@ -937,9 +937,13 @@ font-lock keywords will not be case sensitive."
              (scan-error nil))
       (when (< fill-column (current-column))
         (backward-sexp)
-        (delete-horizontal-space)
-        (insert "\n"))
-      (indent-according-to-mode)
+        (if (equal (point) (save-excursion (back-to-indentation) (point)))
+            ;; First expression in this line, a newline won't help.
+            ;; Give up and move back forward.
+            (forward-sexp)
+          ;; Break line.
+          (delete-horizontal-space)
+          (insert "\n")))
       (delete-horizontal-space)
       (cond
        ((eq (char-after) ?\;)
@@ -949,7 +953,9 @@ font-lock keywords will not be case sensitive."
        (t (insert " "))))
     (delete-all-space)
     (when (eq (char-after) ?\;)
-      (comment-indent))))
+      (comment-indent))
+    (indent-region (car (reverse (nth 9 (syntax-ppss))))
+                   (progn (up-list) (point)))))
 
 (defun lisp-slurp-forward (n)
   (interactive "p")