bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#26619: 26.0.50; Wrong indentation in emacs-lisp-mode


From: npostavs
Subject: bug#26619: 26.0.50; Wrong indentation in emacs-lisp-mode
Date: Wed, 26 Apr 2017 18:31:53 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Kaushal Modi <kaushal.modi@gmail.com> writes:

>
> I tried that patch, but now the indentation is all compressed!
>
> Earlier, the default indentation was 2 spaces, now it is 1.

Um, right, I didn't test that patch properly, it doesn't work at all.
Here's a fix for it, cumulative diff also attached.

---   a/lisp/emacs-lisp/lisp-mode.el
+++   b/lisp/emacs-lisp/lisp-mode.el
@@ -816,20 +816,15 @@ lisp-indent-region
           (while
               (progn
                 (setq parse-state (parse-partial-sexp last-syntax-point 
target-point
-                                                      nil t oldstate))
-                (if (>= (point) target-point)
-                    nil                   ; Done.
-                  (when (= (nth 0 parse-state) (nth 0 oldstate)) ; Stopped 
before open paren.
-                    (setq parse-state (parse-partial-sexp last-syntax-point 
target-point
-                                                          (1+ (nth 0 
parse-state)) nil parse-state)))
-                  (setq last-syntax-point (point))
-                  ;; It's important to preserve last sexp location for
-                  ;; `calculate-lisp-indent', but it's only relevant at the
-                  ;; same depth.
-                  (unless (or (nth 2 parse-state) (/= (nth 0 parse-state) (nth 
0 oldstate)))
-                    (setf (nth 2 parse-state) (nth 2 oldstate)))
-                  t))
-            (setq oldstate parse-state)))
+                                                      (nth 0 oldstate) nil 
oldstate))
+                (setq last-syntax-point (point))
+                (< (point) target-point))
+            (setq oldstate parse-state))
+          ;; It's important to preserve last sexp location for
+          ;; `calculate-lisp-indent', but it's only relevant at the
+          ;; same depth.
+          (unless (or (nth 2 parse-state) (/= (nth 0 parse-state) (nth 0 
oldstate)))
+            (setf (nth 2 parse-state) (nth 2 oldstate))))
         ;; Update cache's depth stack.
         (funcall calc-indent (car parse-state))
         (and pr (progress-reporter-update pr (point))))

Attachment: 26619-cumulative.diff
Description: cumulative patch


reply via email to

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