[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")
- [elpa] master updated (2bc63b5 -> 6c6432b), Artur Malabarba, 2015/10/13
- [elpa] master 24746ff 1/8: Drop Names dependency, Artur Malabarba, 2015/10/13
- [elpa] master 4f9e3d5 4/8: Also skip \r\xc when moving forward, Artur Malabarba, 2015/10/13
- [elpa] master 6c6432b 8/8: * GNUmakefile: Update due to a dependency change, Artur Malabarba, 2015/10/13
- [elpa] master 4d47113 6/8: Fix stupid stupid bug, Artur Malabarba, 2015/10/13
- [elpa] master dd31bf0 2/8: Only track changes if the mode is active, Artur Malabarba, 2015/10/13
- [elpa] master afdedc8 7/8: Merge commit '4d47113ec079dfac1bacb987572c93eefdb176ba', Artur Malabarba, 2015/10/13
- [elpa] master cb69b5b 5/8: [Fix #59] Be more careful about indenting empty lines,
Artur Malabarba <=
- [elpa] master 7a93754 3/8: Fix warnings, Artur Malabarba, 2015/10/15