From 93c5f98ee28de5d24c66274fc92773f245b00b4c Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 22 Aug 2024 16:04:22 -0400 Subject: [PATCH] fix(vc-gutter): resist errors in kill-buffer advice A regression introduced in aa8c31c. Fix: #8018 Ref: #8009 Amend: aa8c31cf0806 --- modules/ui/vc-gutter/config.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/ui/vc-gutter/config.el b/modules/ui/vc-gutter/config.el index 4c9eac6c7..dc1e053c9 100644 --- a/modules/ui/vc-gutter/config.el +++ b/modules/ui/vc-gutter/config.el @@ -192,8 +192,9 @@ Respects `diff-hl-disable-on-remote'." ;; triggered from Elisp's buffer API (from what I can tell). (defadvice! +vc-gutter--kill-diff-hl-thread-a (&optional buf) :before #'kill-buffer - (with-current-buffer (or buf (current-buffer)) - (+vc-gutter--kill-thread t))) + (when-let ((buf (ignore-errors (window-normalize-buffer buf)))) + (with-current-buffer buf + (+vc-gutter--kill-thread t)))) ;; HACK: diff-hl won't be visible in TTY frames, but there's no simple way to ;; use the fringe in GUI Emacs and use the margin in the terminal *AND*