Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion diff-hl.el
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ contents as they are (or would be) after applying the changes in NEW."
(run-hook-with-args-until-success 'diff-hl-async-inhibit-functions
default-directory))))

(defvar diff-hl-timer nil)
(defvar-local diff-hl-timer nil)

(defun diff-hl-update ()
"Updates the diff-hl overlay."
Expand Down
9 changes: 9 additions & 0 deletions test/diff-hl-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@
(diff-hl-test-teardown))))
(put 'diff-hl-deftest 'lisp-indent-function 'defun)

(ert-deftest diff-hl-update-once-schedules-per-buffer ()
(let ((diff-hl-timer nil)
(calls 0))
(cl-letf (((symbol-function 'run-with-idle-timer)
(lambda (&rest _) (cl-incf calls))))
(with-temp-buffer (diff-hl-update-once))
(with-temp-buffer (diff-hl-update-once)))
(should (= calls 2))))

(diff-hl-deftest diff-hl-insert ()
(diff-hl-test-in-source
(goto-char (point-max))
Expand Down
Loading