We relied directly on consult for this, meaning it needed the vertico module. Now, it should defer to the user's choice, including helm, ivy and ido.
34 lines
1.2 KiB
EmacsLisp
34 lines
1.2 KiB
EmacsLisp
;;; completion/corfu/autoload.el -*- lexical-binding: t; -*-
|
|
|
|
;;;###autoload
|
|
(defun +corfu-complete-and-exit-minibuffer ()
|
|
(interactive)
|
|
(if (>= corfu--index 0)
|
|
(corfu-complete)
|
|
(corfu-insert))
|
|
(exit-minibuffer))
|
|
|
|
;;;###autoload
|
|
(defun +corfu-move-to-minibuffer ()
|
|
;; Adapted from Corfu's README.
|
|
(interactive)
|
|
(pcase completion-in-region--data
|
|
(`(,beg ,end ,table ,pred . ,extras)
|
|
(let ((completion-extra-properties extras)
|
|
completion-cycle-threshold completion-cycling)
|
|
(funcall (default-value 'completion-in-region-function) beg end table pred)))))
|
|
|
|
;;;###autoload
|
|
(defun +corfu-smart-sep-toggle-escape ()
|
|
"Insert `corfu-separator' or toggle escape if it's already there."
|
|
(interactive)
|
|
(cond ((and (char-equal (char-before) corfu-separator)
|
|
(char-equal (char-before (1- (point))) ?\\))
|
|
(save-excursion (delete-char -2)))
|
|
((char-equal (char-before) corfu-separator)
|
|
(save-excursion (backward-char 1)
|
|
(insert-char ?\\)))
|
|
(t
|
|
;; Without this corfu quits immediately.
|
|
(setq this-command #'corfu-insert-separator)
|
|
(call-interactively #'corfu-insert-separator))))
|