dev: merge branch 'master' of github.com:doomemacs

This commit is contained in:
Matt Nish-Lapidus 2024-08-29 11:01:17 -04:00
commit 17957d1d98
16 changed files with 121 additions and 54 deletions

View file

@ -46,4 +46,48 @@
(let ((cape-dabbrev-check-other-buffers nil))
(cape-dabbrev t)))
;;;###autoload
(defun +corfu/toggle-auto-complete (&optional interactive)
"Toggle as-you-type completion in Corfu."
(interactive (list 'interactive))
(dolist (buf (buffer-list))
(with-current-buffer buf
(when corfu-mode
(if corfu-auto
(remove-hook 'post-command-hook #'corfu--auto-post-command 'local)
(add-hook 'post-command-hook #'corfu--auto-post-command nil 'local)))))
(when interactive
(message "Corfu auto-complete %s" (if corfu-auto "disabled" "enabled")))
(setq corfu-auto (not corfu-auto)))
;;;###autoload
(defun +corfu/dabbrev-or-next (&optional arg)
"Trigger corfu popup and select the first candidate.
Intended to mimic `evil-complete-next', unless the popup is already open."
(interactive "p")
(if corfu--candidates
(corfu-next arg)
(require 'cape)
(let ((cape-dabbrev-check-other-buffers
(bound-and-true-p evil-complete-all-buffers)))
(cape-dabbrev t)
(when (> corfu--total 0)
(corfu--goto (or arg 0))))))
;;;###autoload
(defun +corfu/dabbrev-or-last (&optional arg)
"Trigger corfu popup and select the first candidate.
Intended to mimic `evil-complete-previous', unless the popup is already open."
(interactive "p")
(if corfu--candidates
(corfu-previous arg)
(require 'cape)
(let ((cape-dabbrev-check-other-buffers
(bound-and-true-p evil-complete-all-buffers)))
(cape-dabbrev t)
(when (> corfu--total 0)
(corfu--goto (- corfu--total (or arg 1)))))))
;;; end of autoload.el