feat(corfu): introduce +corfu-inhibit-auto-functions
This commit is contained in:
parent
1ec4bac75e
commit
63e9b11280
1 changed files with 13 additions and 0 deletions
|
@ -28,6 +28,11 @@ TAB/S-TAB.")
|
||||||
"If non-nil, prefer navigating org tables over cycling candidates with
|
"If non-nil, prefer navigating org tables over cycling candidates with
|
||||||
TAB/S-TAB.")
|
TAB/S-TAB.")
|
||||||
|
|
||||||
|
(defvar +corfu-inhibit-auto-functions ()
|
||||||
|
"A list of predicate functions that take no arguments.
|
||||||
|
|
||||||
|
If any return non-nil, `corfu-auto' will not invoke as-you-type completion.")
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Packages
|
;;; Packages
|
||||||
|
@ -79,6 +84,14 @@ See `+corfu-want-minibuffer-completion'."
|
||||||
(list (current-local-map))))))
|
(list (current-local-map))))))
|
||||||
(setq global-corfu-minibuffer #'+corfu-enable-in-minibuffer-p)
|
(setq global-corfu-minibuffer #'+corfu-enable-in-minibuffer-p)
|
||||||
|
|
||||||
|
;; HACK: Augments Corfu to respect `+corfu-inhibit-auto-functions'.
|
||||||
|
(defadvice! +corfu--post-command-a (fn &rest args)
|
||||||
|
"Refresh Corfu after last command."
|
||||||
|
(let ((corfu-auto
|
||||||
|
(if corfu-auto
|
||||||
|
(not (run-hook-with-args-until-success '+corfu-inhibit-auto-functions)))))
|
||||||
|
(apply fn args)))
|
||||||
|
|
||||||
;; HACK: If you want to update the visual hints after completing minibuffer
|
;; HACK: If you want to update the visual hints after completing minibuffer
|
||||||
;; commands with Corfu and exiting, you have to do it manually.
|
;; commands with Corfu and exiting, you have to do it manually.
|
||||||
(defadvice! +corfu--insert-before-exit-minibuffer-a ()
|
(defadvice! +corfu--insert-before-exit-minibuffer-a ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue