GNU bug report logs - #26619
26.0.50; Wrong indentation in emacs-lisp-mode

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Sun, 23 Apr 2017 07:18:01 UTC

Severity: normal

Tags: fixed, patch

Found in version 26.0.50

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: npostavs <at> users.sourceforge.net
To: Kaushal Modi <kaushal.modi <at> gmail.com>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>, 26619 <at> debbugs.gnu.org
Subject: bug#26619: 26.0.50; Wrong indentation in emacs-lisp-mode
Date: Wed, 26 Apr 2017 18:31:53 -0400
[Message part 1 (text/plain, inline)]
Kaushal Modi <kaushal.modi <at> 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.

[26619-fixup.diff (text/x-diff, inline)]
---   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))))
[26619-cumulative.diff (text/plain, attachment)]

This bug report was last modified 8 years and 72 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.