Skip to content

Commit

Permalink
[Workaround] Fix running timmer error.
Browse files Browse the repository at this point in the history
  • Loading branch information
seagle0128 committed Jul 4, 2020
1 parent a0fdde6 commit 0b73a11
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lisp/init-edit.el
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,23 @@
(if (> (buffer-size) (* 3000 80))
(aggressive-indent-mode -1)))))
:config
;; FIXME: Fix running timmer error
;; @see https://github.com/Malabarba/aggressive-indent-mode/issues/138
(defun my-aggressive-indent--indent-if-changed (buffer)
"Indent any region that changed in BUFFER in the last command loop."
(if (not (buffer-live-p buffer))
(when (timerp aggressive-indent--idle-timer)
(cancel-timer aggressive-indent--idle-timer))
(with-current-buffer buffer
(when (and aggressive-indent-mode aggressive-indent--changed-list)
(save-excursion
(save-selected-window
(aggressive-indent--while-no-input
(aggressive-indent--proccess-changed-list-and-indent))))
(when (timerp aggressive-indent--idle-timer)
(cancel-timer aggressive-indent--idle-timer))))))
(advice-add #'aggressive-indent--indent-if-changed :override #'my-aggressive-indent--indent-if-changed)

;; Disable in some modes
(dolist (mode '(asm-mode web-mode html-mode css-mode go-mode scala-mode prolog-inferior-mode))
(push mode aggressive-indent-excluded-modes))
Expand Down

0 comments on commit 0b73a11

Please sign in to comment.