From 01121ac2d432e6927d34da2c641356fc898edbd6 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 9 Dec 2018 14:32:56 -0500 Subject: km/magit-refs-toggle-tags: Don't implement with add-hook's LOCAL Magit will warn about an inappropriate value when the hook has a non-function value. Instead, use the same approach used by km/magit-cherry-toggle-upstream-section. --- lisp/km-magit.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lisp/km-magit.el') diff --git a/lisp/km-magit.el b/lisp/km-magit.el index 56921e6..b64765e 100644 --- a/lisp/km-magit.el +++ b/lisp/km-magit.el @@ -452,10 +452,14 @@ argument." This only affects the current buffer and is useful if you do not show tags by default." (interactive) - (if (memq 'magit-insert-tags magit-refs-sections-hook) - (remove-hook 'magit-refs-sections-hook 'magit-insert-tags t) - (add-hook 'magit-refs-sections-hook 'magit-insert-tags t t)) - (magit-refresh-buffer)) + (let ((pos (point))) + (if (memq 'magit-insert-tags magit-refs-sections-hook) + (kill-local-variable 'magit-refs-sections-hook) + (setq-local magit-refs-sections-hook + (append magit-refs-sections-hook + '(magit-insert-tags)))) + (magit-refresh-buffer) + (goto-char pos))) (defun km/magit-revision-insert-related-refs () (interactive) -- cgit v1.2.3