Skip to content

Commit

Permalink
Merge pull request #125 from CeleritasCelery/revert
Browse files Browse the repository at this point in the history
Prevent aggressive-indent-mode from modifying buffer after revert
  • Loading branch information
Malabarba authored Feb 18, 2019
2 parents 1f09fe2 + 584e3f9 commit 3803f24
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions aggressive-indent.el
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,10 @@ or messages."
(setq aggressive-indent--changed-list
(cdr aggressive-indent--changed-list))))))

(defun aggressive-indent--clear-change-list ()
"Clear cache of all changed regions. "
(setq aggressive-indent--changed-list nil))

(defcustom aggressive-indent-sit-for-time 0.05
"Time, in seconds, to wait before indenting.
If you feel aggressive-indent is causing Emacs to hang while
Expand Down Expand Up @@ -504,11 +508,13 @@ If BODY finishes, `while-no-input' returns whatever value BODY produced."
(aggressive-indent--local-electric nil)
(aggressive-indent--local-electric t))
(add-hook 'after-change-functions #'aggressive-indent--keep-track-of-changes nil 'local)
(add-hook 'after-revert-hook #'aggressive-indent--clear-change-list nil 'local)
(add-hook 'before-save-hook #'aggressive-indent--proccess-changed-list-and-indent nil 'local))
;; Clean the hooks
(when (timerp aggressive-indent--idle-timer)
(cancel-timer aggressive-indent--idle-timer))
(remove-hook 'after-change-functions #'aggressive-indent--keep-track-of-changes 'local)
(remove-hook 'after-revert-hook #'aggressive-indent--clear-change-list 'local)
(remove-hook 'before-save-hook #'aggressive-indent--proccess-changed-list-and-indent 'local)
(remove-hook 'post-command-hook #'aggressive-indent--softly-indent-defun 'local)))

Expand Down

0 comments on commit 3803f24

Please sign in to comment.