Function: majutsu-ref-candidate-data
majutsu-ref-candidate-data is a natively compiled function defined in
majutsu-ref.el.
Signature
(majutsu-ref-candidate-data KIND &optional CANDIDATES DIRECTORY)
Documentation
Return completion payload for ref KIND in DIRECTORY.
When CANDIDATES is non-nil, use it instead of derived local ref candidates.
Source Code
;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-ref.el
(defun majutsu-ref-candidate-data (kind &optional candidates directory)
"Return completion payload for ref KIND in DIRECTORY.
When CANDIDATES is non-nil, use it instead of derived local ref candidates."
(let ((default-directory (or directory default-directory))
(entries (make-hash-table :test #'equal))
local-candidates)
(condition-case _
(dolist (row (majutsu-ref-completion-entries kind default-directory))
(let* ((name (plist-get row :name))
(remote (plist-get row :remote))
(entry (or (gethash name entries)
(list :name name
:tracked-remotes nil
:untracked-remotes nil))))
(when (plist-get row :conflict)
(setq entry (plist-put entry :conflict t)))
(if remote
(setq entry
(plist-put entry
(if (plist-get row :tracked)
:tracked-remotes
:untracked-remotes)
(majutsu--append-unique
(plist-get entry
(if (plist-get row :tracked)
:tracked-remotes
:untracked-remotes))
remote)))
(setq entry (plist-put entry :local t))
(when (plist-get row :synced)
(setq entry (plist-put entry :synced t)))
(setq local-candidates
(majutsu--append-unique local-candidates name)))
(puthash name entry entries)))
(error nil))
(list :category (majutsu-ref--category kind)
:candidates (or candidates local-candidates)
:entries entries
:annotation-suffix-function
(majutsu-ref--completion-suffix-function kind entries))))