Function: corfu--update

corfu--update is a byte-compiled function defined in corfu.el.

Signature

(corfu--update &optional INTERRUPTIBLE)

Documentation

Update state, optionally INTERRUPTIBLE.

Source Code

;; Defined in ~/.emacs.d/elpa/corfu-20260813.950/corfu.el
(defun corfu--update (&optional interruptible)
  "Update state, optionally INTERRUPTIBLE."
  (pcase-let* ((`(,beg ,end ,table ,pred . ,_) completion-in-region--data)
               (pt (- (point) beg))
               (str (buffer-substring-no-properties beg end))
               (input (cons str pt)))
    (unless (equal corfu--input input)
      ;; Redisplay such that the input is immediately shown before the expensive
      ;; candidate recomputation (gh:minad/corfu#48). See also corresponding
      ;; issue gh:minad/vertico#89.
      (when interruptible (redisplay))
      ;; Bind non-essential=t to prevent Tramp from opening new connections,
      ;; without the user explicitly requesting it via M-TAB.
      (pcase (let ((non-essential t))
               (if interruptible
                   (while-no-input (corfu--compute input table pred))
                 (corfu--compute input table pred)))
        ('nil (keyboard-quit))
        ((and state (pred consp))
         (dolist (s state) (set (car s) (cdr s))))))
    input))