Skip to content

Commit

Permalink
Unconditionally setup topics spec in status buffers
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tarsius committed Jul 12, 2024
1 parent 0102834 commit 03d012a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 6 additions & 0 deletions lisp/forge-topic.el
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
8 changes: 1 addition & 7 deletions lisp/forge.el
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 03d012a

Please sign in to comment.