Function: majutsu-completing-read-payload

majutsu-completing-read-payload is a natively compiled function defined in majutsu-base.el.

Signature

(majutsu-completing-read-payload PROMPT PAYLOAD &optional PREDICATE REQUIRE-MATCH INITIAL-INPUT HIST DEF CATEGORY CONTEXT DIRECTORY)

Documentation

Read one value from structured completion PAYLOAD.

PAYLOAD may provide :category and richer completion metadata. CONTEXT is bound as majutsu-completion-context while the reader is active. DIRECTORY is bound as default-directory, allowing completion actions to operate in the repository that produced the candidates. REQUIRE-MATCH follows majutsu-completing-read.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-base.el
(defun majutsu-completing-read-payload
    (prompt payload &optional predicate require-match initial-input hist def category context directory)
  "Read one value from structured completion PAYLOAD.
PAYLOAD may provide :category and richer completion metadata.  CONTEXT is
bound as `majutsu-completion-context' while the reader is active.  DIRECTORY
is bound as `default-directory', allowing completion actions to operate in the
repository that produced the candidates.
REQUIRE-MATCH follows `majutsu-completing-read'."
  (let* ((default-directory (or directory default-directory))
         (majutsu-completion-context context)
         (completion-extra-properties
          (majutsu-completion-payload-properties payload category))
         (collection (plist-get payload :candidates))
         (value (completing-read (format-prompt prompt def)
                                 collection predicate
                                 (if (eq require-match 'any) nil require-match)
                                 initial-input hist def)))
    (if (equal value "")
        (if require-match
            (user-error "Nothing selected")
          nil)
      value)))