Function: avy-process

avy-process is an autoloaded and byte-compiled function defined in avy.el.

Signature

(avy-process CANDIDATES &optional OVERLAY-FN CLEANUP-FN)

Documentation

Select one of CANDIDATES using avy-read.

Use OVERLAY-FN to visualize the decision overlay. CLEANUP-FN should take no arguments and remove the effects of multiple OVERLAY-FN invocations.

Aliases

avy--process (obsolete since 0.4.0)

Source Code

;; Defined in ~/.emacs.d/elpa/avy-20241101.1357/avy.el
;;;###autoload
(defun avy-process (candidates &optional overlay-fn cleanup-fn)
  "Select one of CANDIDATES using `avy-read'.
Use OVERLAY-FN to visualize the decision overlay.
CLEANUP-FN should take no arguments and remove the effects of
multiple OVERLAY-FN invocations."
  (setq overlay-fn (or overlay-fn (avy--style-fn avy-style)))
  (setq cleanup-fn (or cleanup-fn #'avy--remove-leading-chars))
  (unless (and (consp (car candidates))
               (windowp (cdar candidates)))
    (setq candidates
          (mapcar (lambda (x) (cons x (selected-window)))
                  candidates)))
  (setq avy-last-candidates (copy-sequence candidates))
  (let ((original-cands (copy-sequence candidates))
        (res (avy--process-1 candidates overlay-fn cleanup-fn)))
    (cond
      ((null res)
       (if (and (eq avy-style 'words) candidates)
           (avy-process original-cands overlay-fn cleanup-fn)
         (message "zero candidates")
         t))
      ((eq res 'restart)
       (avy-process original-cands overlay-fn cleanup-fn))
      ;; ignore exit from `avy-handler-function'
      ((eq res 'exit))
      ((eq res 'abort)
       nil)
      (t
       (funcall avy-pre-action res)
       (setq res (car res))
       (let ((action (or avy-action avy-action-oneshot 'avy-action-goto)))
         (funcall action
                  (if (consp res)
                      (car res)
                    res)))
       res))))