refactor(corfu): conform to conventions

This commit is contained in:
Henrik Lissner
2025-03-30 18:30:55 -04:00
parent 2eca701615
commit dfe5b8d4e9
2 changed files with 11 additions and 5 deletions

View File

@ -1,5 +1,13 @@
;;; completion/corfu/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +corfu-dabbrev-friend-buffer-p (other-buffer)
(< (buffer-size other-buffer) +corfu-buffer-scanning-size-limit))
;;
;;; Commands
;;;###autoload
(defun +corfu/move-to-minibuffer ()
"Move the current list of candidates to your choice of minibuffer completion UI."

View File

@ -144,8 +144,6 @@ See `+corfu-want-minibuffer-completion'."
(when (modulep! +dabbrev)
(setq cape-dabbrev-check-other-buffers t)
;; Set up `cape-dabbrev' options.
(defun +dabbrev-friend-buffer-p (other-buffer)
(< (buffer-size other-buffer) +corfu-buffer-scanning-size-limit))
(add-hook! '(prog-mode-hook
text-mode-hook
conf-mode-hook
@ -155,7 +153,7 @@ See `+corfu-want-minibuffer-completion'."
(defun +corfu-add-cape-dabbrev-h ()
(add-hook 'completion-at-point-functions #'cape-dabbrev 20 t)))
(after! dabbrev
(setq dabbrev-friend-buffer-function #'+dabbrev-friend-buffer-p
(setq dabbrev-friend-buffer-function #'+corfu-dabbrev-friend-buffer-p
dabbrev-ignored-buffer-regexps
'("\\` "
"\\(?:\\(?:[EG]?\\|GR\\)TAGS\\|e?tags\\|GPATH\\)\\(<[0-9]+>\\)?")
@ -173,8 +171,8 @@ See `+corfu-want-minibuffer-completion'."
;; From the `cape' readme. Without this, Eshell autocompletion is broken on
;; Emacs28.
(when (< emacs-major-version 29)
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent)
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify))
(advice-add #'pcomplete-completions-at-point :around #'cape-wrap-silent)
(advice-add #'pcomplete-completions-at-point :around #'cape-wrap-purify))
(when (modulep! :lang latex)
;; Allow file completion on latex directives.