dev: updating from latest

This commit is contained in:
Matt Nish-Lapidus 2024-02-16 14:47:53 -05:00
commit 17d363e37a
2 changed files with 21 additions and 3 deletions

View file

@ -10,13 +10,30 @@
;;;###autoload ;;;###autoload
(defun +corfu-move-to-minibuffer () (defun +corfu-move-to-minibuffer ()
;; Adapted from Corfu's README. "Move the current list of candidates to your choice of minibuffer completion UI."
(interactive) (interactive)
(pcase completion-in-region--data (pcase completion-in-region--data
(`(,_ ,_ ,table ,pred ,extras) (`(,beg ,end ,table ,pred ,extras)
(let ((completion-extra-properties extras) (let ((completion-extra-properties extras)
completion-cycle-threshold completion-cycling) completion-cycle-threshold completion-cycling)
(completing-read "Completion: " table pred nil nil 'corfu-history))))) (cond ((and (modulep! :completion vertico)
(fboundp #'consult-completion-in-region))
(consult-completion-in-region beg end table pred))
((and (modulep! :completion ivy)
(fboundp #'ivy-completion-in-region))
(ivy-completion-in-region (marker-position beg) (marker-position end) table pred))
;; Helm is special and wants to _wrap_ `completion--in-region'
;; instead of replacing it in `completion-in-region-function'.
((and (modulep! :completion helm)
(fboundp #'helm--completion-in-region)
(advice-member-p #'helm--completion-in-region #'completion--in-region))
;; Important: `completion-in-region-function' is set to corfu at
;; this moment, so `completion-in-region' (single -) doesn't work.
(completion--in-region beg end table pred))
;; Ido doesn't implement `completion-in-region', and its
;; `completing-read' only accepts a plain list of strings as table,
;; so there's not much we can do with it.
(t (error "No minibuffer completion UI available for moving to!")))))))
;;;###autoload ;;;###autoload
(defun +corfu-smart-sep-toggle-escape () (defun +corfu-smart-sep-toggle-escape ()

View file

@ -24,6 +24,7 @@ Can be negative.")
(use-package! helm-mode (use-package! helm-mode
:hook (doom-first-input . helm-mode) :hook (doom-first-input . helm-mode)
:config :config
(advice-add #'completion--in-region :around #'helm--completion-in-region)
;; helm is too heavy for `find-file-at-point' ;; helm is too heavy for `find-file-at-point'
(add-to-list 'helm-completing-read-handlers-alist (cons #'find-file-at-point nil))) (add-to-list 'helm-completing-read-handlers-alist (cons #'find-file-at-point nil)))