branch: externals/diff-hl
commit 7da881a957b8c15ddcc754dd73543c95b128d716
Author: Dmitry Gutov <dmi...@gutov.dev>
Commit: Dmitry Gutov <dmi...@gutov.dev>

    Fix the previous change: kill the temp buffer inside the thread instead
    
    Using with-temp-buffer made the buffers stay around: kill-buffer at the end 
of
    that macro's definition was a no-op because of thread pinning.
---
 diff-hl.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/diff-hl.el b/diff-hl.el
index 3345eeffc6..bce51f460c 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -420,11 +420,13 @@ It can be a relative expression as well, such as 
\"HEAD^\" with Git, or
             (run-hook-with-args-until-success 'diff-hl-async-inhibit-functions
                                               default-directory)))
       ;; TODO: debounce if a thread is already running.
-      (let ((buf (current-buffer)))
+      (let ((buf (current-buffer))
+            (temp-buffer (generate-new-buffer " *temp*" t)))
         ;; Switch buffer temporarily, to "unlock" it for other threads.
-        (with-temp-buffer
+        (with-current-buffer temp-buffer
           (make-thread
            (lambda ()
+             (kill-buffer temp-buffer)
              (when (buffer-live-p buf)
                (set-buffer buf)
                (diff-hl--update-safe)))

Reply via email to