Skip to content

Commit

Permalink
forge--clone-buffer-topics-spec: New function
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tarsius committed Jul 20, 2024
1 parent d5ee56d commit 9edfcb2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lisp/forge-issue.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lisp/forge-pullreq.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions lisp/forge-topic.el
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit 9edfcb2

Please sign in to comment.