Function: cape--super-prefix

cape--super-prefix is a byte-compiled function defined in cape.el.

Signature

(cape--super-prefix BEG END RESULTS)

Documentation

Find tables from Capf RESULTS matching prefix at BEG to END.

Source Code

;; Defined in ~/.emacs.d/elpa/cape-20260804.2303/cape.el
(defun cape--super-prefix (beg end results)
  "Find tables from Capf RESULTS matching prefix at BEG to END."
  (let (tables exc prefix-len)
    (cl-loop
     for (main beg2 end2 table . plist) in results do
     ;; Note: `cape-capf-super' currently cannot merge Capfs which trigger at
     ;; different beginning positions.  In order to support this, take the
     ;; smallest BEG value and then normalize all candidates by prefixing them
     ;; such that they all start at the smallest BEG position.
     (when (= beg beg2)
       (push (list main (plist-get plist :predicate) table
                   (cl-loop for f in cape--super-functions
                            for v = (plist-get plist f)
                            if v collect f and collect v))
             tables)
       ;; The resulting merged Capf is exclusive if one of the main
       ;; Capfs is exclusive.
       (when (and main (not (eq (plist-get plist :exclusive) 'no)))
         (setq exc t))
       (setq end (max end end2))
       (let ((plen (plist-get plist :company-prefix-length)))
         (cond
          ((eq plen t)
           (setq prefix-len t))
          ((and (not prefix-len) (integerp plen))
           (setq prefix-len plen))
          ((and (integerp prefix-len) (integerp plen))
           (setq prefix-len (max prefix-len plen)))))))
    (list (nreverse tables) exc prefix-len)))