]> code.delx.au - gnu-emacs-elpa/commitdiff
[Fix #53] Indent more aggressively
authorArtur Malabarba <bruce.connor.am@gmail.com>
Wed, 12 Aug 2015 19:56:39 +0000 (20:56 +0100)
committerArtur Malabarba <bruce.connor.am@gmail.com>
Wed, 12 Aug 2015 19:56:39 +0000 (20:56 +0100)
aggressive-indent.el

index 636504d3aa72e053e5d5339035cf59af545747ec..82e5fbfdc6d905f170771074e8c537294241a15d 100644 (file)
@@ -325,10 +325,15 @@ until nothing more happens."
                  (point-limit (if (and eod (< (point) eod))
                                   eod (point-max-marker))))
             (while (and (null (eobp))
-                        (< (point) point-limit)
-                        (/= (point)
-                            (progn (indent-according-to-mode)
-                                   (point))))
+                        (let ((op (point))
+                              (np (progn (indent-according-to-mode)
+                                         (point))))
+                          ;; As long as we're indenting things to the
+                          ;; left, keep indenting.
+                          (or (< np op)
+                              ;; If we're indenting to the right, or
+                              ;; not at all, stop at the limit.
+                              (< (point) point-limit))))
               (forward-line 1)
               (skip-chars-forward "[:blank:]\n"))))
       (goto-char p))))