emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] master cb69b5b 5/8: [Fix #59] Be more careful about indenting emp


From: Artur Malabarba
Subject: [elpa] master cb69b5b 5/8: [Fix #59] Be more careful about indenting empty lines
Date: Tue, 13 Oct 2015 16:37:27 +0000

branch: master
commit cb69b5b560b35c6b1fd00db945ff52577148a26f
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    [Fix #59] Be more careful about indenting empty lines
---
 aggressive-indent.el |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/aggressive-indent.el b/aggressive-indent.el
index 0622ccb..c6005e0 100644
--- a/aggressive-indent.el
+++ b/aggressive-indent.el
@@ -157,7 +157,7 @@ active.  If the minor mode is turned on with the local 
command,
   :type '(repeat symbol)
   :package-version '(aggressive-indent . "0.3.1"))
 
-(defcustom aggressive-indent-protected-commands '(undo undo-tree-undo 
undo-tree-redo)
+(defcustom aggressive-indent-protected-commands '(undo undo-tree-undo 
undo-tree-redo whitespace-cleanup)
   "Commands after which indentation will NOT be performed.
 Aggressive indentation could break things like `undo' by locking
 the user in a loop, so this variable is used to control which
@@ -306,19 +306,16 @@ until nothing more happens."
     (set-marker-insertion-type p t)
     (unwind-protect
         (progn
-          (goto-char r)
-          (setq was-begining-of-line
-                (= r (line-beginning-position)))
+          (unless (= l r)
+            (when (= (char-before r) ?\n)
+              (cl-decf r)))
           ;; If L is at the end of a line, skip that line.
           (unless (= l r)
-            (goto-char l)
-            (when (= l (line-end-position))
+            (when (= (char-after l) ?\n)
               (cl-incf l)))
           ;; Indent the affected region.
+          (goto-char r)
           (unless (= l r) (indent-region l r))
-          ;; `indent-region' doesn't do anything if R was the beginning of a 
line, so we indent manually there.
-          (when was-begining-of-line
-            (indent-according-to-mode))
           ;; And then we indent each following line until nothing happens.
           (forward-line 1)
           (skip-chars-forward "[:blank:]\n\r\xc")



reply via email to

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