Function: forge-topics-setup-buffer
forge-topics-setup-buffer is a byte-compiled function defined in
forge-topics.el.
Signature
(forge-topics-setup-buffer &optional REPO SPEC &rest PARAMS)
Documentation
List a set of topics in a buffer.
The buffer is determined using forge-topics-buffer-name, which uses
the same buffer for all global lists, and likewise just one buffer per
repository for repository-local lists. You could use cl-letf to use
a different buffer for certain sets.
If optional REPO is non-nil, it must be a forge-repository(var)/forge-repository(fun) object.
It is only relevant when not showing a global topic list, as determined
by the value of :global in PARAMS. Even when showing a local list,
REPO may be nil, in that case the repository is determined from context.
If optional SPEC is non-nil, it must be a forge--topics-spec(var)/forge--topics-spec(fun) object.
If nil, a clone of the existing filter spec from the buffer determined
above is used, provided that buffer already exists and has a local
filter spec. A clone of forge-list-buffer-default-topic-filters is
used otherwise.
Optional PARAMS can be used to set slots of SPEC. PARAMS is a plist
where each key is an initarg for a slot of the forge--topics-spec(var)/forge--topics-spec(fun)
class.
Usually you would use nil for SPEC, so that a clone of the currently effective filter spec is used, and then you would set only some of the available filters using PARAMS.
(transient-define-suffix my-forge-list-assigned-issues ()
"List issues of the current repository that are assigned to me."
:description "issues"
(declare (interactive-only nil))
(interactive)
(when-let* ((repo (forge-get-repository :tracked))
(me (ghub--username repo)))
(forge-topics-setup-buffer repo nil :type 'issue :assignee me)
(transient-setup 'forge-topics-menu)))
Grep Forge for more examples.
Alternatively you can use forge-insert-topics list topics in, e.g.,
the Magit status buffer.
Source Code
;; Defined in ~/.emacs.d/elpa/forge-20260408.1922/forge-topics.el
(defun forge-topics-setup-buffer (&optional repo spec &rest params)
"List a set of topics in a buffer.
The buffer is determined using `forge-topics-buffer-name', which uses
the same buffer for all global lists, and likewise just one buffer per
repository for repository-local lists. You could use `cl-letf' to use
a different buffer for certain sets.
If optional REPO is non-nil, it must be a `forge-repository' object.
It is only relevant when not showing a global topic list, as determined
by the value of `:global' in PARAMS. Even when showing a local list,
REPO may be nil, in that case the repository is determined from context.
If optional SPEC is non-nil, it must be a `forge--topics-spec' object.
If nil, a clone of the existing filter spec from the buffer determined
above is used, provided that buffer already exists and has a local
filter spec. A clone of `forge-list-buffer-default-topic-filters' is
used otherwise.
Optional PARAMS can be used to set slots of SPEC. PARAMS is a plist
where each key is an initarg for a slot of the `forge--topics-spec'
class.
Usually you would use nil for SPEC, so that a clone of the currently
effective filter spec is used, and then you would set only some of
the available filters using PARAMS.
(transient-define-suffix my-forge-list-assigned-issues ()
\"List issues of the current repository that are assigned to me.\"
:description \"issues\"
(declare (interactive-only nil))
(interactive)
(when-let* ((repo (forge-get-repository :tracked))
(me (ghub--username repo)))
(forge-topics-setup-buffer repo nil :type \\='issue :assignee me)
(transient-setup \\='forge-topics-menu)))
Grep Forge for more examples.
Alternatively you can use `forge-insert-topics' list topics in, e.g.,
the Magit status buffer."
(let* ((global (or (plist-get params :global)
(and spec (oref spec global))))
(repo (or repo
(and (not global)
(if-let* ((topic (forge-topic-at-point))
(repo (forge-get-repository topic)))
repo
(forge-get-repository :tracked?)))))
(dir (or (and repo (forge-get-worktree repo)) "/"))
(buf (forge-topics-buffer-name repo))
(buf (or (get-buffer buf) buf))
(spec (cond (spec (clone spec))
((and (bufferp buf)
(buffer-local-value 'forge--buffer-topics-spec buf)))
((clone forge-list-buffer-default-topic-filters)))))
(while-let ((key (pop params)))
(eieio-oset spec (intern (substring (symbol-name key) 1)) (pop params)))
(unless (oref spec type)
(oset spec type 'topic))
(forge--cast-topics-spec-state spec)
(unless (or repo global)
(error "Cannot determine repository"))
(magit-setup-buffer #'forge-topics-mode nil
:buffer (get-buffer-create buf)
:directory dir
(forge-buffer-repository (and repo (oref repo id)))
(forge--buffer-topics-spec spec)
(forge-buffer-unassociated-p global))))