Function: consult--split-setup
consult--split-setup is a byte-compiled function defined in
consult.el.
Signature
(consult--split-setup SPLIT)
Documentation
Setup splitting completion style with splitter function SPLIT.
Source Code
;; Defined in ~/.emacs.d/elpa/consult-20260805.1130/consult.el
(defun consult--split-setup (split)
"Setup splitting completion style with splitter function SPLIT."
(when (equal completion-styles '(consult--split))
(error "`consult--async-split-input' initialized twice"))
(let* ((styles completion-styles)
(catdef completion-category-defaults)
(catovr completion-category-overrides)
(try (lambda (str table pred point)
(let ((completion-styles styles)
(completion-category-defaults catdef)
(completion-category-overrides catovr)
(pos (cadr (funcall split str))))
(pcase (completion-try-completion (substring str pos) table pred
(max 0 (- point pos)))
('t t)
(`(,newstr . ,newpt)
(setq newstr (concat (substring str 0 pos) newstr))
(if (eq (cadr (funcall split newstr)) pos)
(cons newstr (+ pos newpt))
(cons str point)))))))
(all (lambda (str table pred point)
(let ((completion-styles styles)
(completion-category-defaults catdef)
(completion-category-overrides catovr)
(pos (cadr (funcall split str))))
(completion-all-completions (substring str pos) table pred
(max 0 (- point pos)))))))
(setq-local completion-styles-alist (cons `(consult--split ,try ,all "")
completion-styles-alist)
completion-styles '(consult--split)
completion-category-defaults nil
completion-category-overrides nil)))