Function: majutsu-gerrit--make-counted-string-payload
majutsu-gerrit--make-counted-string-payload is a natively compiled
function defined in majutsu-gerrit.el.
Signature
(majutsu-gerrit--make-counted-string-payload ITEMS CATEGORY LABEL)
Documentation
Build payload from ITEMS with count annotations.
CATEGORY names the completion category and LABEL is shown in annotations.
Source Code
;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-gerrit.el
(defun majutsu-gerrit--make-counted-string-payload (items category label)
"Build payload from ITEMS with count annotations.
CATEGORY names the completion category and LABEL is shown in annotations."
(let ((entries (make-hash-table :test #'equal))
(annotations (make-hash-table :test #'equal))
(counts (make-hash-table :test #'equal))
candidates)
(dolist (item items)
(when (and (stringp item) (not (string-empty-p item)))
(puthash item (1+ (gethash item counts 0)) counts)
(push item candidates)))
(setq candidates (sort (delete-dups candidates) #'string<))
(dolist (candidate candidates)
(puthash candidate
(list :value candidate :count (gethash candidate counts 0))
entries)
(puthash candidate
(format "%s (%d open)" label (gethash candidate counts 0))
annotations))
(and candidates
(list :category category
:candidates candidates
:entries entries
:annotations annotations))))