Function: embark-collect--update-candidates

embark-collect--update-candidates is a byte-compiled function defined in embark.el.

Signature

(embark-collect--update-candidates BUFFER)

Documentation

Update candidates for Embark Collect BUFFER.

Source Code

;; Defined in ~/.emacs.d/elpa/embark-20260610.302/embark.el
(defun embark-collect--update-candidates (buffer)
  "Update candidates for Embark Collect BUFFER."
  (let* ((transformed (embark--maybe-transform-candidates))
         (type (plist-get transformed :orig-type)) ; we need the originals for
         (candidates (plist-get transformed :orig-candidates)) ; default action
         (bounds (plist-get transformed :bounds))
         (affixator (embark--get-affixator type))
         (grouper (embark-collect--metadatum type 'group-function)))
    (when (eq type 'file)
      (let ((dir (buffer-local-value 'default-directory buffer)))
        (setq candidates
              (mapcar (lambda (cand)
                        (let ((rel (file-relative-name cand dir)))
                          (if (string-prefix-p "../" rel) cand rel)))
                      candidates))))
    (if (seq-some #'identity bounds)
      (cl-loop for cand in candidates and (start . _end) in bounds
               when start
               do (add-text-properties
                   0 1 `(embark--location ,(copy-marker start)) cand)))
    (setq candidates (funcall affixator candidates))
    (with-current-buffer buffer
      (setq embark--type type)
      (unless embark--command
        (setq embark--command #'embark--goto))
      (embark-collect--format-entries candidates grouper))
    candidates))