-;;; aggressive-indent.el --- Minor mode to aggressively keep your code always indented
+;;; aggressive-indent.el --- Minor mode to aggressively keep your code always indented -*- lexical-binding:t -*-
-;; Copyright (C) 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2015 Free Software Foundation, Inc
;; Author: Artur Malabarba <emacs@endlessparentheses.com>
;; URL: http://github.com/Malabarba/aggressive-indent-mode
- ;; Version: 1.1.2
+ ;; Version: 1.1.3
;; Package-Requires: ((emacs "24.1") (names "20150125.9") (cl-lib "0.5"))
;; Keywords: indent lisp maint tools
;; Prefix: aggressive-indent
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
-;; as published by the Free Software Foundation; either version 2
+;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
(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))))