branch: externals/aggressive-indent
commit 8e70039c7190639c43794cb75eae118c2faaa0d1
Merge: 1d7185d 450fe20
Author: Artur Malabarba <[email protected]>
Commit: GitHub <[email protected]>
Merge pull request #115 from joaotavora/master
Check no-indent conditions at lower level, so they work on save
---
aggressive-indent.el | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/aggressive-indent.el b/aggressive-indent.el
index 8718373..5042f6f 100644
--- a/aggressive-indent.el
+++ b/aggressive-indent.el
@@ -389,20 +389,22 @@ or messages."
(defun aggressive-indent--proccess-changed-list-and-indent ()
"Indent the regions in `aggressive-indent--changed-list'."
- (let ((inhibit-modification-hooks t)
- (inhibit-point-motion-hooks t)
- (indent-function
- (if (cl-member-if #'derived-mode-p
aggressive-indent-modes-to-prefer-defun)
- #'aggressive-indent--softly-indent-defun
#'aggressive-indent--softly-indent-region-and-on)))
- ;; Take the 10 most recent changes.
- (let ((cell (nthcdr 10 aggressive-indent--changed-list)))
- (when cell (setcdr cell nil)))
- ;; (message "----------")
- (while aggressive-indent--changed-list
- ;; (message "%S" (car aggressive-indent--changed-list))
- (apply indent-function (car aggressive-indent--changed-list))
- (setq aggressive-indent--changed-list
- (cdr aggressive-indent--changed-list)))))
+ (unless (or (run-hook-wrapped 'aggressive-indent--internal-dont-indent-if
#'eval)
+ (aggressive-indent--run-user-hooks))
+ (let ((inhibit-modification-hooks t)
+ (inhibit-point-motion-hooks t)
+ (indent-function
+ (if (cl-member-if #'derived-mode-p
aggressive-indent-modes-to-prefer-defun)
+ #'aggressive-indent--softly-indent-defun
#'aggressive-indent--softly-indent-region-and-on)))
+ ;; Take the 10 most recent changes.
+ (let ((cell (nthcdr 10 aggressive-indent--changed-list)))
+ (when cell (setcdr cell nil)))
+ ;; (message "----------")
+ (while aggressive-indent--changed-list
+ ;; (message "%S" (car aggressive-indent--changed-list))
+ (apply indent-function (car aggressive-indent--changed-list))
+ (setq aggressive-indent--changed-list
+ (cdr aggressive-indent--changed-list))))))
(defcustom aggressive-indent-sit-for-time 0.05
"Time, in seconds, to wait before indenting.
@@ -418,10 +420,8 @@ typing, try tweaking this number."
(when (and aggressive-indent-mode aggressive-indent--changed-list)
(save-excursion
(save-selected-window
- (unless (or (run-hook-wrapped
'aggressive-indent--internal-dont-indent-if #'eval)
- (aggressive-indent--run-user-hooks))
- (while-no-input
- (aggressive-indent--proccess-changed-list-and-indent)))))
+ (while-no-input
+ (aggressive-indent--proccess-changed-list-and-indent))))
(when (timerp aggressive-indent--idle-timer)
(cancel-timer aggressive-indent--idle-timer))))