Function: projection-completion--annotation-function

projection-completion--annotation-function is a natively compiled function defined in projection-core-completion.el.

Signature

(projection-completion--annotation-function &key (KEY-FUNCTION #'identity))

Documentation

Generate an annotation-function for completing-read.

KEY-FUNCTION will be used to query the annotation for each candidate.

Source Code

;; Defined in /nix/store/j6y921qbdmdqxjnd43iibapbig3p4hai-emacs-packages-deps/share/emacs/site-lisp/elpa/projection-20260614.1822/projection-core-completion.el
(cl-defun projection-completion--annotation-function
    (&key (key-function #'identity))
  "Generate an annotation-function for `completing-read'.
KEY-FUNCTION will be used to query the annotation for each candidate."
  (let ((max-width (max 40 (/ (frame-width) 2))))
    (lambda (cand)
      (when-let* ((annotation (funcall key-function cand))
                  (annotation (s-truncate max-width annotation "…")))
        (concat (propertize
                 " " 'display
                 `(space :align-to (- right 1 ,(length annotation))))
                (propertize annotation 'face 'completions-annotations))))))