From 03d012ae24eafa89a1a5ba7d9ed4069b05d54e21 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Fri, 12 Jul 2024 15:13:09 +0200 Subject: [PATCH] Unconditionally setup topics spec in status buffers A user may set `forge-add-default-sections' to nil in and then manually add these sections in a different place. Previously they would have had to also manually add `forge--init-buffer-topics-spec' to `magit-status-mode-hook', but that's an internal detail, they should not have to know about. Closes #681. --- lisp/forge-topic.el | 6 ++++++ lisp/forge.el | 8 +------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lisp/forge-topic.el b/lisp/forge-topic.el index a790bf8d..8ab0ca66 100644 --- a/lisp/forge-topic.el +++ b/lisp/forge-topic.el @@ -333,6 +333,12 @@ an error." (defvar-local forge--buffer-topics-spec nil) (put 'forge--buffer-topics-spec 'permanent-local t) +(defun forge--init-buffer-topics-spec () + (unless forge--buffer-topics-spec + (setq forge--buffer-topics-spec + (clone forge-status-buffer-default-topic-filters)))) +(add-hook 'magit-status-mode-hook #'forge--init-buffer-topics-spec) + (defclass forge--topics-spec () ((type :documentation "\ Limit list based on topic type." diff --git a/lisp/forge.el b/lisp/forge.el index daa88770..faefbaac 100644 --- a/lisp/forge.el +++ b/lisp/forge.el @@ -68,15 +68,9 @@ If you want to disable this, then you must set this to nil before `forge' is loaded.") -(defun forge--init-buffer-topics-spec () - (unless forge--buffer-topics-spec - (setq forge--buffer-topics-spec - (clone forge-status-buffer-default-topic-filters)))) - (when forge-add-default-sections (magit-add-section-hook 'magit-status-sections-hook #'forge-insert-pullreqs nil t) - (magit-add-section-hook 'magit-status-sections-hook #'forge-insert-issues nil t) - (add-hook 'magit-status-mode-hook #'forge--init-buffer-topics-spec)) + (magit-add-section-hook 'magit-status-sections-hook #'forge-insert-issues nil t)) ;;; Add Bindings