2022-09-24 17:33:32 -03:00
|
|
|
;;; completion/corfu/autoload.el -*- lexical-binding: t; -*-
|
|
|
|
|
2023-12-21 12:07:39 -03:00
|
|
|
;;;###autoload
|
|
|
|
(defun +corfu-complete-and-exit-minibuffer ()
|
|
|
|
(interactive)
|
|
|
|
(if (>= corfu--index 0)
|
|
|
|
(corfu-complete)
|
|
|
|
(corfu-insert))
|
|
|
|
(exit-minibuffer))
|
|
|
|
|
2022-09-24 17:33:32 -03:00
|
|
|
;;;###autoload
|
|
|
|
(defun +corfu-move-to-minibuffer ()
|
2024-02-04 17:17:13 -03:00
|
|
|
;; Adapted from Corfu's README.
|
2022-09-24 17:33:32 -03:00
|
|
|
(interactive)
|
2024-02-04 17:17:13 -03:00
|
|
|
(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)))))
|
2023-10-29 14:31:13 -03:00
|
|
|
|
|
|
|
;;;###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))))
|