Artawower / blamer.el

A git blame plugin for emacs inspired by VS Code's GitLens plugin
GNU General Public License v3.0
426 stars 15 forks source link

Async overlay is still shown even after blamer-mode is off #70

Closed daanturo closed 2 months ago

daanturo commented 2 months ago

When the async operation hasn't finished but blamer-mode is turned off, the commit info is still displayed and it stays there without going away (because the mode is off, auto-clear mechanics doesn't apply).

The sequence happens in this order:

  1. post-command-hook triggers fetching git info asyncly (1)
  2. (blamer-mode 0)
  3. (1) returned and the commit info is displayed

Reproduce:

  1. Evaluate
    (progn
    (defvar-local _count 0)
    (add-hook 'post-command-hook
            (lambda ()
              (cl-incf _count)
              ;; Use _count here because looks like pressing Enter in "M-:"
              ;; counts as executing a command
              (when (= 2 _count)
                (message "blamer off!")
                (blamer-mode 0)))
            nil 'local))
  2. Do anything such as move the cursor once

Observed:

Commit info is displayed and doesn't go away.

Expected:

Commit info isn't displayed without blamer-mode.

Artawower commented 2 months ago

Thank you! One of the best pull request I've ever seen, with such a good explanation and reproduction steps! Really great job