Merge branch 'master' into corfu-update-smart-tab

This commit is contained in:
StrawberryTea 2024-04-12 13:45:44 -05:00 committed by GitHub
commit 390f5920a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
95 changed files with 928 additions and 1520 deletions

View file

@ -212,6 +212,14 @@ A few variables may be set to change behavior of this module:
Whether to prefer navigating org tables over cycling candidates when pressing
[[kbd:][TAB]] and [[kbd:][S-TAB]].
** Turning off auto-completion
To disable idle (as-you-type) completion, unset ~corfu-auto~:
#+begin_src emacs-lisp
;;; in $DOOMDIR/config.el
(after! corfu
(setq corfu-auto nil))
#+end_src
** Adding CAPFs to a mode
To add other CAPFs on a mode-per-mode basis, put either of the following in your
~config.el~:
@ -242,7 +250,7 @@ all CAPFs are interactive to be called this way, in which case you can use
* Troubleshooting
[[doom-report:][Report an issue?]]
** Performance issues with ~cape-dabbrev~
** Troubleshooting ~cape-dabbrev~
If you have performance issues with ~cape-dabbrev~, the first thing I recommend
doing is to look at the list of buffers Dabbrev is scanning:
@ -255,6 +263,22 @@ doing is to look at the list of buffers Dabbrev is scanning:
... and modify ~dabbrev-ignored-buffer-regexps~ or ~dabbrev-ignored-buffer-modes~
accordingly.
If you see garbage completion candidates, you can use the following command to
debug the issue:
#+begin_src emacs-lisp
;;;###autoload
(defun search-in-dabbrev-buffers (search-string)
"Search for SEARCH-STRING in all buffers returned by `dabbrev--select-buffers'."
(interactive "sSearch string: ")
(let ((buffers (dabbrev--select-buffers)))
(multi-occur buffers search-string)))
;; Example usage:
;; Why are these weird characters appearing in my completions?
(search-in-dabbrev-buffers "\342\200\231")
#+end_src
** Fixing TAB Keybindings
If you encounter an issue where your ~TAB~ keybindings are not responding in Doom

View file

@ -40,7 +40,8 @@ TAB/S-TAB.")
('aggressive
(not (or (bound-and-true-p mct--active)
(bound-and-true-p vertico--input)
(eq (current-local-map) read-passwd-map)
(and (featurep 'auth-source)
(eq (current-local-map) read-passwd-map))
(and (featurep 'helm-core) (helm--alive-p))
(and (featurep 'ido) (ido-active))
(where-is-internal 'minibuffer-complete
@ -53,7 +54,7 @@ TAB/S-TAB.")
(corfu-mode +1))))
:config
(setq corfu-auto t
corfu-auto-delay 0.1
corfu-auto-delay 0.18
corfu-auto-prefix 2
global-corfu-modes '((not
erc-mode
@ -67,8 +68,10 @@ TAB/S-TAB.")
corfu-count 16
corfu-max-width 120
corfu-on-exact-match nil
corfu-quit-at-boundary (if (modulep! +orderless) 'separator t)
corfu-quit-no-match (if (modulep! +orderless) 'separator t)
corfu-quit-at-boundary (if (or (modulep! :completion vertico)
(modulep! +orderless))
'separator t)
corfu-quit-no-match corfu-quit-at-boundary
tab-always-indent 'complete)
(add-to-list 'completion-category-overrides `(lsp-capf (styles ,@completion-styles)))
(add-to-list 'corfu-auto-commands #'lispy-colon)
@ -112,10 +115,10 @@ TAB/S-TAB.")
(use-package! cape
:defer t
:init
(add-hook! prog-mode
(add-hook! 'prog-mode-hook
(defun +corfu-add-cape-file-h ()
(add-hook 'completion-at-point-functions #'cape-file -10 t)))
(add-hook! (org-mode markdown-mode)
(add-hook! '(org-mode-hook markdown-mode-hook)
(defun +corfu-add-cape-elisp-block-h ()
(add-hook 'completion-at-point-functions #'cape-elisp-block 0 t)))
;; Enable Dabbrev completion basically everywhere as a fallback.
@ -124,17 +127,23 @@ TAB/S-TAB.")
;; 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 text-mode conf-mode comint-mode minibuffer-setup
eshell-mode)
(add-hook! '(prog-mode-hook
text-mode-hook
conf-mode-hook
comint-mode-hook
minibuffer-setup-hook
eshell-mode-hook)
(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
dabbrev-ignored-buffer-regexps
'("^ "
'("\\` "
"\\(TAGS\\|tags\\|ETAGS\\|etags\\|GTAGS\\|GRTAGS\\|GPATH\\)\\(<[0-9]+>\\)?")
dabbrev-upcase-means-case-search t)
(add-to-list 'dabbrev-ignored-buffer-modes 'pdf-view-mode)))
(add-to-list 'dabbrev-ignored-buffer-modes 'pdf-view-mode)
(add-to-list 'dabbrev-ignored-buffer-modes 'doc-view-mode)
(add-to-list 'dabbrev-ignored-buffer-modes 'tags-table-mode)))
;; Make these capfs composable.
(advice-add #'lsp-completion-at-point :around #'cape-wrap-noninterruptible)

View file

@ -1,12 +1,16 @@
;; -*- no-byte-compile: t; -*-
;;; completion/corfu/packages.el
(package! corfu :pin "c1e7b6190b00158e67347b4db0a8f7964e5d2f8b")
(package! cape :pin "a397a0c92de38277b7f835fa999fac400a764908")
(package! corfu :pin "35cd5a0f3cba89766072e3e933d1fe2ee02f2289")
(package! cape :pin "e01e4430234850263d326ad4521849cd46e64059")
(when (modulep! +icons)
(package! nerd-icons-corfu :pin "7077bb76fefc15aed967476406a19dc5c2500b3c"))
(when (modulep! +orderless)
(package! orderless :pin "b24748093b00b37c3a572c4909f61c08fa27504f"))
(when (and (not (modulep! :completion vertico))
(modulep! +orderless))
;; enabling +orderless without vertico should be fairly niche enough that to
;; save contributor headaches we should only pin vertico's orderless and leave
;; this one unpinned
(package! orderless))
(when (modulep! :os tty)
(package! corfu-terminal :pin "501548c3d51f926c687e8cd838c5865ec45d03cc"))
(when (modulep! :editor snippets)