Function: orderless-affix-dispatch

orderless-affix-dispatch is a byte-compiled function defined in orderless.el.

Signature

(orderless-affix-dispatch COMPONENT INDEX TOTAL)

Documentation

Match COMPONENT according to the styles in orderless-affix-dispatch-alist.

If the COMPONENT starts or ends with one of the characters used as a key in orderless-affix-dispatch-alist, then that character is removed and the remainder of the COMPONENT is matched in the style associated to the character.

Source Code

;; Defined in ~/.emacs.d/elpa/orderless-20260519.1029/orderless.el
(defun orderless-affix-dispatch (component _index _total)
  "Match COMPONENT according to the styles in `orderless-affix-dispatch-alist'.
If the COMPONENT starts or ends with one of the characters used
as a key in `orderless-affix-dispatch-alist', then that character
is removed and the remainder of the COMPONENT is matched in the
style associated to the character."
  (let ((len (length component))
        (alist orderless-affix-dispatch-alist))
    (when (> len 0)
      (cond
       ;; Ignore single dispatcher character
       ((and (= len 1) (alist-get (aref component 0) alist)) #'ignore)
       ;; Prefix
       ((when-let* ((style (alist-get (aref component 0) alist)))
          (cons style (substring component 1))))
       ;; Suffix
       ((when-let* ((style (alist-get (aref component (1- len)) alist)))
          (cons style (substring component 0 -1))))))))