Function: majutsu-completion-affixation-function

majutsu-completion-affixation-function is a natively compiled function defined in majutsu-completion.el.

Signature

(majutsu-completion-affixation-function SUFFIX-FUNCTION)

Documentation

Return aligned affixation function backed by SUFFIX-FUNCTION.

SUFFIX-FUNCTION is called with a completion candidate and should return the suffix string to display, or nil for no suffix.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-completion.el
(defun majutsu-completion-affixation-function (suffix-function)
  "Return aligned affixation function backed by SUFFIX-FUNCTION.
SUFFIX-FUNCTION is called with a completion candidate and should return the
suffix string to display, or nil for no suffix."
  (when suffix-function
    (lambda (candidates)
      (let ((width (if candidates
                       (apply #'max 0 (mapcar #'string-width candidates))
                     0)))
        (mapcar (lambda (candidate)
                  (let ((suffix (funcall suffix-function candidate)))
                    (list candidate ""
                          (if (and suffix (> (length suffix) 0))
                              (concat (make-string (max 0 (- width (string-width candidate))) ?\s)
                                      suffix)
                            ""))))
                candidates)))))