Function: cape-wrap-choose

cape-wrap-choose is an autoloaded and byte-compiled function defined in cape.el.

Signature

(cape-wrap-choose &rest CAPFS)

Documentation

Call each of CAPFS in turn and return first non-nil result.

Use cape-wrap-choose to create a single Capf from multiple Capfs. Usually you want to add multiple non-exclusive Capfs to the variable completion-at-point-functions directly instead. See the dual cape-wrap-super if you want to merge multiple Capf results.

Source Code

;; Defined in ~/.emacs.d/elpa/cape-20260804.2303/cape.el
;;;###autoload
(defun cape-wrap-choose (&rest capfs)
  "Call each of CAPFS in turn and return first non-nil result.
Use `cape-wrap-choose' to create a single Capf from multiple Capfs.
Usually you want to add multiple non-exclusive Capfs to the variable
`completion-at-point-functions' directly instead.  See the dual
`cape-wrap-super' if you want to merge multiple Capf results."
  (cl-loop
   for capf in capfs thereis
   (pcase (funcall capf)
     ((and result `(,beg ,end ,table . ,plist))
      (let* ((str (buffer-substring-no-properties beg end))
             (pt (- (point) beg))
             (pred (plist-get plist :predicate))
             (md (completion-metadata (substring str 0 pt) table pred)))
        ;; Treat the Capfs always as non-exclusive. Return the first which
        ;; returns non-nil. See also the comment in `corfu--capf-wrapper'.
        (and (completion-try-completion str table pred pt md)
             result))))))