Function: forge--read-topic
forge--read-topic is a natively compiled function defined in
forge-topic.el.
Signature
(forge--read-topic PROMPT CURRENT ACTIVE ALL &optional REQUIRE-MATCH)
Source Code
;; Defined in /nix/store/923zwib42c4qw6x4xps0cv1wi8qcd6lp-emacs-packages-deps/share/emacs/site-lisp/elpa/forge-20261005.753/forge-topic.el
(defun forge--read-topic (prompt current active all &optional require-match)
(let* ((current (funcall current))
(repo (forge-get-repository (or current :tracked)))
(default (and current (forge--format-topic-line current)))
(alist (forge--topic-collection
(forge--list-topics (if forge-limit-topic-choices active all)
repo)))
(choices (mapcar #'car alist))
(choices (cond ((and forge-limit-topic-choices
default
(not (member default choices)))
(push (cons default (oref current id)) alist)
(cons default choices))
(choices))))
(catch 'return
(while t
(let ((input
(if forge-limit-topic-choices
(minibuffer-with-setup-hook
(lambda ()
(use-local-map (make-composed-keymap
forge-read-topic-minibuffer-map
(current-local-map))))
(magit-completing-read
(substitute-command-keys
(format "%s (\\<%s>\\[%s] for all)" prompt
'forge-read-topic-minibuffer-map
'forge-read-topic-lift-limit))
(completion-table-dynamic
(let (all-choices)
(lambda (_string)
(cond
(all-choices)
(forge-limit-topic-choices choices)
(t
(setq alist (forge--topic-collection
(forge--list-topics all repo)))
(setq all-choices (mapcar #'car alist)))))))
nil require-match nil nil default))
(magit-completing-read
prompt choices nil require-match nil nil default))))
(cond-let
([known (cdr (assoc input alist))]
(throw 'return known))
((not (equal require-match 'any))
(message "Please select one of the listed choices"))
((forge--childp repo 'forge-gitlab-repository)
(if (string-match-p "\\`[#!][1-9][0-9]*\\'" input)
(throw 'return input)
(message "To select an unknown issue use #N, %s"
"To select an unknown pull-request use !N")))
((string-match "\\`#?\\([1-9][0-9]*\\)\\'" input)
(throw 'return (string-to-number (match-string 1 input))))
((message "To select an unknown topic enter an integer")))
(sit-for 2))))))