summaryrefslogtreecommitdiff
path: root/lisp/km-magit.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2018-12-09 14:32:56 -0500
committerKyle Meyer <kyle@kyleam.com>2018-12-09 14:32:56 -0500
commit01121ac2d432e6927d34da2c641356fc898edbd6 (patch)
tree7dfd93d9bfa23aa44bd15027e4a9da63938b04a1 /lisp/km-magit.el
parent97081cd777837824b0df441314343ed252a05405 (diff)
downloademacs.d-01121ac2d432e6927d34da2c641356fc898edbd6.tar.gz
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.
Diffstat (limited to 'lisp/km-magit.el')
-rw-r--r--lisp/km-magit.el12
1 files changed, 8 insertions, 4 deletions
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)