Function: jinx--correct-overlay

jinx--correct-overlay is a natively compiled function defined in jinx.el.

Signature

(jinx--correct-overlay OVERLAY &key INFO INITIAL)

Documentation

Correct word at OVERLAY.

Optionally show prompt INFO and insert INITIAL input.

Source Code

;; Defined in /nix/store/b5jnxgwmlp7hh60wfrx7amhrmrpfcqqi-emacs-packages-deps/share/emacs/site-lisp/elpa/jinx-20260926.912/jinx.el
(cl-defun jinx--correct-overlay (overlay &key info initial)
  "Correct word at OVERLAY.
Optionally show prompt INFO and insert INITIAL input."
  (catch 'jinx--goto
    (let* ((word (buffer-substring-no-properties
                  (overlay-start overlay) (overlay-end overlay)))
           (choice
            (jinx--correct-highlight overlay
              (lambda ()
                (when (or (< (point) (window-start)) (> (point) (window-end nil t)))
                  (recenter))
                (minibuffer-with-setup-hook
                    #'jinx--correct-setup
                  (or (completing-read
                       (format "Correct ‘%s’%s: " word (or info ""))
                       (completion-table-with-metadata
                        (jinx--correct-suggestions word)
                        `((category . jinx)
                          (eager-display . t)
                          (display-sort-function . ,#'identity)
                          (cycle-sort-function . ,#'identity)
                          (group-function . ,#'jinx--group)
                          (affixation-function . ,#'jinx--correct-affixation)))
                       nil nil initial t word)
                      word)))))
           (len (length choice)))
      (pcase (and (> len 0) (assq (aref choice 0) jinx--save-keys))
        (`(,key . ,fun)
         (funcall fun 'add key
                  (if (> len 1) (substring-no-properties choice 1) word))
         (jinx--recheck-overlays))
        ((guard (not (equal choice word)))
         (jinx--correct-replace overlay choice)))
      nil)))