Skip to content

Commit

Permalink
Try a different method of keeping timers from getting out of hand
Browse files Browse the repository at this point in the history
Close #121
Another attempt at #112
  • Loading branch information
Malabarba committed Jan 7, 2019
1 parent 4994a50 commit d4616c8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions aggressive-indent.el
Original file line number Diff line number Diff line change
Expand Up @@ -417,13 +417,15 @@ typing, try tweaking this number."

(defun aggressive-indent--indent-if-changed ()
"Indent any region that changed in the last command loop."
(when (and aggressive-indent-mode aggressive-indent--changed-list)
(save-excursion
(save-selected-window
(while-no-input
(aggressive-indent--proccess-changed-list-and-indent))))
(when (timerp aggressive-indent--idle-timer)
(cancel-timer aggressive-indent--idle-timer))))
(if (not (buffer-live-p (current-buffer)))
(cancel-timer aggressive-indent--idle-timer)
(when (and aggressive-indent-mode aggressive-indent--changed-list)
(save-excursion
(save-selected-window
(while-no-input
(aggressive-indent--proccess-changed-list-and-indent))))
(when (timerp aggressive-indent--idle-timer)
(cancel-timer aggressive-indent--idle-timer)))))

(defun aggressive-indent--keep-track-of-changes (l r &rest _)
"Store the limits (L and R) of each change in the buffer."
Expand Down

0 comments on commit d4616c8

Please sign in to comment.