branch: master
commit c4957eb4fcfa54f8f536926c892123697f7e8204
Author: Artur Malabarba <[email protected]>
Commit: Artur Malabarba <[email protected]>
Fix bug on buffers with no final newline.
Fixes #19
---
aggressive-indent.el | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/aggressive-indent.el b/aggressive-indent.el
index ee106e4..b0bc742 100644
--- a/aggressive-indent.el
+++ b/aggressive-indent.el
@@ -107,6 +107,7 @@ Please include this in your report!"
(defcustom excluded-modes
'(text-mode tabulated-list-mode special-mode
minibuffer-inactive-mode
+ bibtex-mode
yaml-mode jabber-chat-mode)
"Modes in which `aggressive-indent-mode' should not be activated.
This variable is only used if `global-aggressive-indent-mode' is
@@ -274,10 +275,11 @@ until nothing more happens."
(indent-according-to-mode))
;; And then we indent each following line until nothing happens.
(forward-line 1)
- (while (/= (progn (skip-chars-forward "[:blank:]\n")
- (point))
- (progn (indent-according-to-mode)
- (point)))
+ (while (and (null (eobp))
+ (/= (progn (skip-chars-forward "[:blank:]\n")
+ (point))
+ (progn (indent-according-to-mode)
+ (point))))
(forward-line 1))
(goto-char p)))