From 9edfcb2c1528dc7e607daa2d8fa655fc80e0d8b7 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Sat, 20 Jul 2024 18:59:59 +0200 Subject: [PATCH] forge--clone-buffer-topics-spec: New function Beside cloning `forge--buffer-topics-spec', also ensure that that itself is initialized. Normally this is done when `magit-status-mode' is enabled, but if that happens before this package is loaded, then it is too late for the hook function to run, so we do it like this instead. Re #681. --- lisp/forge-issue.el | 2 +- lisp/forge-pullreq.el | 2 +- lisp/forge-topic.el | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/forge-issue.el b/lisp/forge-issue.el index 103c06bf..e3a0ae74 100644 --- a/lisp/forge-issue.el +++ b/lisp/forge-issue.el @@ -211,7 +211,7 @@ and optional HEADING to change the section heading." (when-let (((forge-db t)) (repo (forge-get-repository :tracked?)) ((oref repo issues-p)) - (spec (if sspec spec (clone forge--buffer-topics-spec))) + (spec (if sspec spec (forge--clone-buffer-topics-spec))) ((memq (oref spec type) '(topic issue)))) (oset spec type 'issue) (forge--insert-topics 'issues diff --git a/lisp/forge-pullreq.el b/lisp/forge-pullreq.el index 1e8de3d7..0d9cda7e 100644 --- a/lisp/forge-pullreq.el +++ b/lisp/forge-pullreq.el @@ -264,7 +264,7 @@ Optional SPEC can be used to override that filtering specification, and optional HEADING to change the section heading." (when-let (((forge-db t)) (repo (forge-get-repository :tracked?)) - (spec (if sspec spec (clone forge--buffer-topics-spec))) + (spec (if sspec spec (forge--clone-buffer-topics-spec))) ((memq (oref spec type) '(topic pullreq)))) (oset spec type 'pullreq) (forge--insert-topics 'pullreqs diff --git a/lisp/forge-topic.el b/lisp/forge-topic.el index 8ab0ca66..85fa35b6 100644 --- a/lisp/forge-topic.el +++ b/lisp/forge-topic.el @@ -339,6 +339,10 @@ an error." (clone forge-status-buffer-default-topic-filters)))) (add-hook 'magit-status-mode-hook #'forge--init-buffer-topics-spec) +(defun forge--clone-buffer-topics-spec () + (forge--init-buffer-topics-spec) + (clone forge--buffer-topics-spec)) + (defclass forge--topics-spec () ((type :documentation "\ Limit list based on topic type."