dotemacs

My Emacs configuration
git clone git://git.entf.net/dotemacs
Log | Files | Refs | LICENSE

README.org (24968B)


      1 #+title: corfu.el - Completion Overlay Region FUnction
      2 #+author: Daniel Mendler
      3 #+language: en
      4 #+export_file_name: corfu.texi
      5 #+texinfo_dir_category: Emacs misc features
      6 #+texinfo_dir_title: Corfu: (corfu).
      7 #+texinfo_dir_desc: Completion Overlay Region FUnction
      8 
      9 #+html: <a href="https://www.gnu.org/software/emacs/"><img alt="GNU Emacs" src="https://github.com/minad/corfu/blob/screenshots/emacs.svg?raw=true"/></a>
     10 #+html: <a href="http://elpa.gnu.org/packages/corfu.html"><img alt="GNU ELPA" src="https://elpa.gnu.org/packages/corfu.svg"/></a>
     11 #+html: <a href="http://elpa.gnu.org/devel/corfu.html"><img alt="GNU-devel ELPA" src="https://elpa.gnu.org/devel/corfu.svg"/></a>
     12 
     13 * Introduction
     14 
     15 Corfu enhances completion at point with a small completion popup. The current
     16 candidates are shown in a popup below or above the point. Corfu is the
     17 minimalistic ~completion-in-region~ counterpart of the [[https://github.com/minad/vertico][Vertico]] minibuffer UI.
     18 
     19 Corfu is a small package, which relies on the Emacs completion facilities and
     20 concentrates on providing a polished completion UI. Completions are either
     21 provided by commands like ~dabbrev-completion~ or by pluggable backends
     22 (~completion-at-point-functions~, Capfs). Most programming language major modes
     23 implement a Capf. Furthermore the language server packages, [[https://github.com/joaotavora/eglot][Eglot]] and [[https://github.com/emacs-lsp/lsp-mode][Lsp-mode]],
     24 use Capfs which talk to the LSP server to retrieve the completions. Corfu does
     25 not include its own completion backends. The Emacs built-in Capfs and the Capfs
     26 provided by other programming language packages are usually sufficient. A few
     27 additional Capfs and completion utilities are provided by the [[https://github.com/minad/cape][Cape]] package.
     28 
     29 *NOTE*: Corfu uses child frames to show the popup and falls back to the default
     30 setting of the ~completion-in-region-function~ on non-graphical displays. There is
     31 a [[https://codeberg.org/akib/emacs-corfu-popup][package in the works]] which uses overlays for the popup such that Corfu can be
     32 used when Emacs is running in a terminal.
     33 
     34 [[https://github.com/minad/corfu/blob/screenshots/light.png?raw=true]]
     35 
     36 [[https://github.com/minad/corfu/blob/screenshots/dark.png?raw=true]]
     37 
     38 * Features
     39 
     40 - Timer-based auto-completions (/off/ by default, set ~corfu-auto~).
     41 - Popup display with scrollbar indicator and arrow key navigation.
     42 - The popup can be summoned explicitly by pressing =TAB= at any time.
     43 - The current candidate is inserted with =TAB= and selected with =RET=.
     44 - Candidates sorting by prefix, string length and alphabetically.
     45 - The selected candidate is previewed (configurable via ~corfu-preview-current~).
     46 - The selected candidate automatically committed on further input by default.
     47   (configurable via ~corfu-preview-current~).
     48 - The [[https://github.com/oantolin/orderless][Orderless]] completion style is supported. The filter string can contain
     49   arbitrary characters, after inserting a space via =M-SPC= (configurable via
     50   ~corfu-quit-at-boundary~ and ~corfu-separator~).
     51 - Deferred completion style highlighting for performance.
     52 - Support for candidate annotations and documentation in the echo area.
     53 - Deprecated candidates are crossed out in the display.
     54 - Icons can be provided by an external package via margin formatter functions.
     55 - Extensions: Quick keys, Index keys, Sorting by history, Candidate documentation
     56 
     57 * Installation and Configuration
     58 
     59 Corfu is available from [[http://elpa.gnu.org/packages/corfu.html][GNU ELPA]], such that it can be installed directly via
     60 ~package-install~. After installation, the global minor mode can be enabled with
     61 =M-x global-corfu-mode=. In order to configure Corfu and other packages in your
     62 init.el, you may want to use ~use-package~.
     63 
     64 Corfu is highly flexible and customizable via ~corfu-*~ customization variables,
     65 such that you can adapt it precisely to your requirements. However in order to
     66 quickly try out the Corfu completion package, it should be sufficient to
     67 activate ~global-corfu-mode~. You can experiment with manual completion for
     68 example in an Elisp buffer or in an Eshell or Shell buffer. For auto completion,
     69 set ~corfu-auto=t~ before turning on ~global-corfu-mode~.
     70 
     71 Here is an example configuration:
     72 
     73 #+begin_src emacs-lisp
     74   (use-package corfu
     75     ;; Optional customizations
     76     ;; :custom
     77     ;; (corfu-cycle t)                ;; Enable cycling for `corfu-next/previous'
     78     ;; (corfu-auto t)                 ;; Enable auto completion
     79     ;; (corfu-separator ?\s)          ;; Orderless field separator
     80     ;; (corfu-quit-at-boundary nil)   ;; Never quit at completion boundary
     81     ;; (corfu-quit-no-match nil)      ;; Never quit, even if there is no match
     82     ;; (corfu-preview-current nil)    ;; Disable current candidate preview
     83     ;; (corfu-preselect-first nil)    ;; Disable candidate preselection
     84     ;; (corfu-on-exact-match nil)     ;; Configure handling of exact matches
     85     ;; (corfu-echo-documentation nil) ;; Disable documentation in the echo area
     86     ;; (corfu-scroll-margin 5)        ;; Use scroll margin
     87 
     88     ;; Enable Corfu only for certain modes.
     89     ;; :hook ((prog-mode . corfu-mode)
     90     ;;        (shell-mode . corfu-mode)
     91     ;;        (eshell-mode . corfu-mode))
     92 
     93     ;; Recommended: Enable Corfu globally.
     94     ;; This is recommended since Dabbrev can be used globally (M-/).
     95     ;; See also `corfu-excluded-modes'.
     96     :init
     97     (global-corfu-mode))
     98 
     99   ;; A few more useful configurations...
    100   (use-package emacs
    101     :init
    102     ;; TAB cycle if there are only few candidates
    103     (setq completion-cycle-threshold 3)
    104 
    105     ;; Emacs 28: Hide commands in M-x which do not apply to the current mode.
    106     ;; Corfu commands are hidden, since they are not supposed to be used via M-x.
    107     ;; (setq read-extended-command-predicate
    108     ;;       #'command-completion-default-include-p)
    109 
    110     ;; Enable indentation+completion using the TAB key.
    111     ;; `completion-at-point' is often bound to M-TAB.
    112     (setq tab-always-indent 'complete))
    113 #+end_src
    114 
    115 Dabbrev completion is based on =completion-in-region= and can be used with Corfu.
    116 You may want to swap the =dabbrev-completion= with the =dabbrev-expand= key for
    117 easier access, if you prefer completion. Also take a look at the =cape-dabbrev=
    118 completion at point function provided by my [[https://github.com/minad/cape][Cape]] package.
    119 
    120 #+begin_src emacs-lisp
    121   ;; Use Dabbrev with Corfu!
    122   (use-package dabbrev
    123     ;; Swap M-/ and C-M-/
    124     :bind (("M-/" . dabbrev-completion)
    125            ("C-M-/" . dabbrev-expand))
    126     ;; Other useful Dabbrev configurations.
    127     :custom
    128     (dabbrev-ignored-buffer-regexps '("\\.\\(?:pdf\\|jpe?g\\|png\\)\\'")))
    129 #+end_src
    130 
    131 If you start to configure the package more deeply, I recommend to give the
    132 Orderless completion style a try for filtering. Orderless completion is
    133 different from the familiar prefix TAB completion. Corfu can be used with the
    134 default completion styles. The use of Orderless is not a necessity.
    135 
    136 #+begin_src emacs-lisp
    137   ;; Optionally use the `orderless' completion style.
    138   (use-package orderless
    139     :init
    140     ;; Configure a custom style dispatcher (see the Consult wiki)
    141     ;; (setq orderless-style-dispatchers '(+orderless-dispatch)
    142     ;;       orderless-component-separator #'orderless-escapable-split-on-space)
    143     (setq completion-styles '(orderless basic)
    144           completion-category-defaults nil
    145           completion-category-overrides '((file (styles . (partial-completion))))))
    146 #+end_src
    147 
    148 The =basic= completion style is specified as fallback in addition to =orderless= in
    149 order to ensure that completion commands which rely on dynamic completion
    150 tables, e.g., ~completion-table-dynamic~ or ~completion-table-in-turn~, work
    151 correctly. See =+orderless-dispatch= in the [[https://github.com/minad/consult/wiki][Consult wiki]] for an advanced Orderless
    152 style dispatcher. Additionally enable =partial-completion= for file path
    153 expansion. =partial-completion= is important for file wildcard support. Multiple
    154 files can be opened at once with =find-file= if you enter a wildcard. You may also
    155 give the =initials= completion style a try.
    156 
    157 See also the [[https://github.com/minad/corfu/wiki][Corfu Wiki]] for additional configuration tips. In particular the
    158 Lsp-mode configuration is documented in the wiki. For more general documentation
    159 read the chapter about completion in the [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Completion.html][Emacs manual]]. If you want to create
    160 your own Capfs, you can find documentation about completion in the [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Completion.html][Elisp manual]].
    161 
    162 ** Auto completion
    163 
    164 Auto completion is disabled by default, but can be enabled by setting
    165 ~corfu-auto=t~. Furthermore you may want to configure Corfu to quit completion
    166 eagerly, such that the completion popup stays out of your way when it appeared
    167 unexpectedly.
    168 
    169 #+begin_src emacs-lisp
    170   ;; Enable auto completion and configure quitting
    171   (setq corfu-auto t
    172         corfu-quit-no-match 'separator) ;; or t
    173 #+end_src
    174 
    175 In general, I recommend to experiment a bit with the various settings and key
    176 bindings to find a configuration which works for you. There is no one size fits
    177 all solution. Some people like auto completion, some like manual completion,
    178 some want to cycle with TAB and some with the arrow keys...
    179 
    180 ** Completing with Corfu in the minibuffer
    181 
    182 Corfu can be used for completion in the minibuffer, since it relies on child
    183 frames to display the candidates. By default, ~global-corfu-mode~ does not
    184 activate ~corfu-mode~ in the minibuffer, to avoid interference with specialised
    185 minibuffer completion UIs like Vertico or Mct. However you may still want to
    186 enable Corfu completion for commands like ~M-:~ (~eval-expression~) or ~M-!~
    187 (~shell-command~), which read from the minibuffer. Activate ~corfu-mode~ only if
    188 ~completion-at-point~ is bound in the minibuffer-local keymap to achieve this
    189 effect.
    190 
    191 #+begin_src emacs-lisp
    192   (defun corfu-enable-in-minibuffer ()
    193     "Enable Corfu in the minibuffer if `completion-at-point' is bound."
    194     (when (where-is-internal #'completion-at-point (list (current-local-map)))
    195       ;; (setq-local corfu-auto nil) Enable/disable auto completion
    196       (corfu-mode 1)))
    197   (add-hook 'minibuffer-setup-hook #'corfu-enable-in-minibuffer)
    198 #+end_src
    199 
    200 You can also enable Corfu more generally for every minibuffer, as long as no
    201 other completion UI is active. If you use Mct or Vertico as your main minibuffer
    202 completion UI, the following snippet should yield the desired result.
    203 
    204 #+begin_src emacs-lisp
    205   (defun corfu-enable-always-in-minibuffer ()
    206     "Enable Corfu in the minibuffer if Vertico/Mct are not active."
    207     (unless (or (bound-and-true-p mct--active)
    208                 (bound-and-true-p vertico--input))
    209       ;; (setq-local corfu-auto nil) Enable/disable auto completion
    210       (corfu-mode 1)))
    211   (add-hook 'minibuffer-setup-hook #'corfu-enable-always-in-minibuffer 1)
    212 #+end_src
    213 
    214 ** Completing with Corfu in the Eshell or Shell
    215 
    216 When completing in the Eshell I recommend conservative local settings without
    217 auto completion, such that the completion behavior is similar to widely used
    218 shells like Bash, Zsh or Fish.
    219 
    220 #+begin_src emacs-lisp
    221   (add-hook 'eshell-mode-hook
    222             (lambda ()
    223               (setq-local corfu-auto nil)
    224               (corfu-mode)))
    225 #+end_src
    226 
    227 When pressing =RET= while the Corfu popup is visible, the ~corfu-insert~ command
    228 will be invoked. This command does inserts the currently selected candidate, but
    229 it does not send the prompt input to Eshell or the comint process. Therefore you
    230 often have to press =RET= twice which feels like an unnecessary double
    231 confirmation. Fortunately it is easy to improve this! In my configuration I
    232 define the advice ~corfu-send-shell~ which sends the candidate after insertion.
    233 
    234 #+begin_src emacs-lisp
    235   (defun corfu-send-shell (&rest _)
    236     "Send completion candidate when inside comint/eshell."
    237     (cond
    238      ((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input))
    239       (eshell-send-input))
    240      ((and (derived-mode-p 'comint-mode)  (fboundp 'comint-send-input))
    241       (comint-send-input))))
    242 
    243   (advice-add #'corfu-insert :after #'corfu-send-shell)
    244 #+end_src
    245 
    246 Shell completion uses the flexible ~pcomplete~ mechanism internally, which allows
    247 you to program the completions per shell command. If you want to know more, look
    248 into this [[https://www.masteringemacs.org/article/pcomplete-context-sensitive-completion-emacs][blog post]], which shows how to configure pcomplete for git commands. I
    249 recommend the [[https://github.com/JonWaltman/pcmpl-args.el][pcmpl-args]] package which extends Pcomplete with completion support
    250 and helpful annotation support for more commands. Similar to the Fish shell,
    251 pcmpl-args uses man page parsing and --help output parsing to dynamically
    252 generate completions. This package brings Eshell completion to another level!
    253 
    254 Unfortunately Pcomplete has a few technical issues, which we can work around
    255 with the [[https://github.com/minad/cape][Cape]] library (Completion at point extensions). Cape provides wrappers,
    256 which sanitize the pcomplete function. Ideally the bugs in pcomplete should be
    257 fixed upstream. *For now these two advices are strongly recommended to achieve a
    258 sane Eshell experience.*
    259 
    260 #+begin_src emacs-lisp
    261   ;; Silence the pcomplete capf, no errors or messages!
    262   (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent)
    263 
    264   ;; Ensure that pcomplete does not write to the buffer
    265   ;; and behaves as a pure `completion-at-point-function'.
    266   (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify)
    267 #+end_src
    268 
    269 ** Orderless completion
    270 
    271 [[https://github.com/oantolin/orderless][Orderless]] is an advanced completion style that supports multi-component search
    272 filters separated by a configurable character (space, by default). Normally,
    273 entering characters like space which lie outside the completion region
    274 boundaries (words, typically) causes Corfu to quit. This behavior is helpful
    275 with auto-completion, which may pop-up when not desired, e.g. on entering a new
    276 variable name. Just keep typing and Corfu will get out of the way.
    277 
    278 But orderless search terms can contain arbitrary characters; they are also
    279 interpreted as regular expressions. To use orderless, set ~corfu-separator~ (a
    280 space, by default) to the primary character of your orderless component
    281 separator.
    282 
    283 Then, when a new orderless component is desired, use =M-SPC=
    284 (~corfu-insert-separator~) to enter the /first/ component separator in the input,
    285 and arbitrary orderless search terms and new separators can be entered
    286 thereafter.
    287 
    288 To treat the entire input as Orderless input, you can set the customization
    289 option ~corfu-quit-at-boundary=t~. This disables the predicate which checks if the
    290 current completion boundary has been left. In contrast, if you /always/ want to
    291 quit at the boundary, simply set ~corfu-quit-at-boundary=nil~. By default
    292 ~corfu-quit-at-boundary~ is set to ~separator~ which quits at completion boundaries
    293 as long as no separator has been inserted with ~corfu-insert-separator~.
    294 
    295 Finally, there exists the user option ~corfu-quit-no-match~ which is set to
    296 =separator= by default. With this setting Corfu stays alive as soon as you start
    297 advanced filtering with a ~corfu-separator~ even if there are no matches, for
    298 example due to a typo. As long as no separator character has been inserted with
    299 ~corfu-insert-separator~, Corfu will still quit if there are no matches. This
    300 ensures that the Corfu popup goes away quickly if completion is not possible.
    301 
    302 In the following we show two configurations, one which works best with auto
    303 completion and one which may work better with manual completion if you prefer to
    304 always use =SPC= to separate the Orderless components.
    305 
    306  #+begin_src emacs-lisp
    307    ;; Auto completion example
    308    (use-package corfu
    309      :custom
    310      (corfu-auto t)          ;; Enable auto completion
    311      ;; (corfu-separator ?_) ;; Set to orderless separator, if not using space
    312      :bind
    313      ;; Another key binding can be used, such as S-SPC.
    314      ;; (:map corfu-map ("M-SPC" . corfu-insert-separator))
    315      :init
    316      (global-corfu-mode))
    317 
    318    ;; Manual completion example
    319    (use-package corfu
    320      :custom
    321      ;; (corfu-separator ?_) ;; Set to orderless separator, if not using space
    322      :bind
    323      ;; Configure SPC for separator insertion
    324      (:map corfu-map ("SPC" . corfu-insert-separator))
    325      :init
    326      (global-corfu-mode))
    327 #+end_src
    328 
    329 ** TAB-and-Go completion
    330 
    331 You may be interested in configuring Corfu in TAB-and-Go style. Pressing TAB
    332 moves to the next candidate and further input will then commit the selection.
    333 Note that further input will not expand snippets or templates, which may not be
    334 desired but which leads overall to a more predictable behavior. In order to
    335 force snippet expansion, confirm a candidate explicitly with ~RET~.
    336 
    337 #+begin_src emacs-lisp
    338   (use-package corfu
    339     ;; TAB-and-Go customizations
    340     :custom
    341     (corfu-cycle t)             ;; Enable cycling for `corfu-next/previous'
    342     (corfu-preselect-first nil) ;; Disable candidate preselection
    343 
    344     ;; Use TAB for cycling, default is `corfu-complete'.
    345     :bind
    346     (:map corfu-map
    347           ("TAB" . corfu-next)
    348           ([tab] . corfu-next)
    349           ("S-TAB" . corfu-previous)
    350           ([backtab] . corfu-previous))
    351 
    352     :init
    353     (global-corfu-mode))
    354 #+end_src
    355 
    356 ** Transfer completion to the minibuffer
    357 
    358 Sometimes it is useful to transfer the Corfu completion session to the
    359 minibuffer, since the minibuffer offers richer interaction features. In
    360 particular, [[https://github.com/oantolin/embark][Embark]] is available in the minibuffer, such that you can act on the
    361 candidates or export/collect the candidates to a separate buffer. Hopefully we
    362 can also add Corfu-support to Embark in the future, such that at least
    363 export/collect is possible directly from Corfu. But in my opinion having the
    364 ability to transfer the Corfu completion to the minibuffer is an even better
    365 feature, since further completion can be performed there.
    366 
    367 The command ~corfu-move-to-minibuffer~ is defined here in terms of
    368 ~consult-completion-in-region~, which uses the minibuffer completion UI via
    369 ~completing-read~.
    370 
    371 #+begin_src emacs-lisp
    372   (defun corfu-move-to-minibuffer ()
    373     (interactive)
    374     (let ((completion-extra-properties corfu--extra)
    375           completion-cycle-threshold completion-cycling)
    376       (apply #'consult-completion-in-region completion-in-region--data)))
    377   (define-key corfu-map "\M-m" #'corfu-move-to-minibuffer)
    378 #+end_src
    379 
    380 * Key bindings
    381 
    382 Corfu uses a transient keymap ~corfu-map~ which is active while the popup is
    383 shown. The keymap defines the following remappings and bindings:
    384 
    385 - ~beginning-of-buffer~ -> ~corfu-first~
    386 - ~end-of-buffer~ -> ~corfu-last~
    387 - ~scroll-down-command~ -> ~corfu-scroll-down~
    388 - ~scroll-up-command~ -> ~corfu-scroll-up~
    389 - ~next-line~, =down=, =M-n= -> ~corfu-next~
    390 - ~previous-line~, =up=, =M-p= -> ~corfu-previous~
    391 - ~completion-at-point~, =TAB= -> ~corfu-complete~
    392 - =RET= -> ~corfu-insert~
    393 - =M-g= -> ~corfu-info-location~
    394 - =M-h= -> ~corfu-info-documentation~
    395 - =M-SPC= -> ~corfu-insert-separator~
    396 - =C-g= -> ~corfu-quit~
    397 - ~keyboard-escape-quit~ -> ~corfu-reset~
    398 
    399 * Extensions
    400 :properties:
    401 :custom_id: extensions
    402 :end:
    403 
    404 We maintain small extension packages to Corfu in this repository in the
    405 subdirectory [[https://github.com/minad/corfu/tree/main/extensions][extensions/]]. The extensions are installed together with Corfu if
    406 you pull the package from ELPA. The extensions are inactive by default and can
    407 be enabled manually if desired. Furthermore it is possible to install all of the
    408 files separately, both ~corfu.el~ and the ~corfu-*.el~ extensions. Currently the
    409 following extensions come with the Corfu ELPA package:
    410 
    411 - [[https://github.com/minad/corfu/blob/main/extensions/corfu-history.el][corfu-history]]: =corfu-history-mode= to remember selected candidates and to improve sorting.
    412 - [[https://github.com/minad/corfu/blob/main/extensions/corfu-indexed.el][corfu-indexed]]: =corfu-indexed-mode= to select indexed candidates with prefix arguments.
    413 - [[https://github.com/minad/corfu/blob/main/extensions/corfu-info.el][corfu-info]]: Candidate actions to access the candidate location and documentation.
    414 - [[https://github.com/minad/corfu/blob/main/extensions/corfu-quick.el][corfu-quick]]: Commands to select using Avy-style quick keys.
    415 
    416 * Complementary packages
    417 
    418 Corfu works well together with all packages providing code completion via the
    419 ~completion-at-point-functions~. Many modes and packages already provide a Capf
    420 out of the box. Nevertheless you may want to look into complementary packages to
    421 enhance your setup.
    422 
    423 - [[https://github.com/oantolin/orderless][Orderless]]: Corfu supports completion styles, including the advanced
    424   [[https://github.com/oantolin/orderless][Orderless]] completion style, where the filtering expressions are separated by
    425   spaces or another character (see ~corfu-separator~).
    426 
    427 - [[https://github.com/minad/cape][Cape]]: Additional Capf backends and =completion-in-region= commands
    428   are provided by the [[https://github.com/minad/cape][Cape]] package. Among others, the package supplies a file
    429   path and a dabbrev completion backend. Cape provides the ~cape-company-to-capf~
    430   adapter to reuse Company backends in Corfu. Furthermore the function
    431   ~cape-super-capf~ can merge multiple Capfs, such that the candidates of multiple
    432   Capfs are displayed together at the same time.
    433 
    434 - [[https://github.com/jdtsmith/kind-icon][kind-icon]]: Icons are supported by Corfu via an external package. For example
    435   the [[https://github.com/jdtsmith/kind-icon][kind-icon]] package provides beautifully styled SVG icons based on
    436   monochromatic icon sets like material design.
    437 
    438 - [[https://github.com/galeo/corfu-doc][corfu-doc]]: The corfu-doc package displays the candidate documentation in a
    439   popup next to the Corfu popup, similar to =company-quickhelp=.
    440 
    441 - [[https://github.com/JonWaltman/pcmpl-args.el][pcmpl-args]]: Extend the Eshell/Shell Pcomplete mechanism with support for many
    442   more commands. Similar to the Fish shell, Pcomplete uses man page parsing to
    443   dynamically retrieve the completions and helpful annotations. This package
    444   brings Eshell completions to another level!
    445 
    446 - [[https://github.com/minad/tempel][Tempel]]: Tiny template/snippet package with templates in Lisp syntax, which
    447   can be used in conjunction with Corfu.
    448 
    449 - [[https://github.com/minad/vertico][Vertico]]: You may also want to look into my [[https://github.com/minad/vertico][Vertico]] package. Vertico is the
    450   minibuffer completion counterpart of Corfu.
    451 
    452 * Alternatives
    453 
    454 - [[https://github.com/company-mode/company-mode][Company]]: Company is a widely used and mature completion package, which
    455   implements a similar interaction model and popup UI as Corfu. While Corfu
    456   relies exclusively on the standard Emacs completion API (Capfs), Company
    457   defines its own API for the backends. Company includes its completion
    458   backends, which are incompatible with the Emacs completion infrastructure. As
    459   a result of this design, Company is a more complex package than Corfu. Company
    460   by default uses overlays for the popup in contrast to the child frames used by
    461   Corfu. Overall both packages work well, but Company integrates less tightly
    462   with Emacs. The ~completion-styles~ support is more limited and the
    463   ~completion-at-point~ command and the ~completion-in-region~ function do not
    464   invoke Company.
    465 
    466 - [[https://git.sr.ht/~protesilaos/mct][Mct]]: Protesilaos' Minibuffer Confines Transcended package supports both
    467   minibuffer completion and completion in region. It reuses the default
    468   completion UI for this purpose and installs a timer which live updates the
    469   completion buffer. The main advantage of Mct is that you work with a regular
    470   Emacs buffer instead of with a popup. You can take advantage of the usual
    471   Emacs commands to navigate in the completions buffer. On top, Mct enhances the
    472   movement such that you can quickly switch between the completions buffer and
    473   the minibuffer or the region which is being completed. Mct does not support
    474   timer-based auto completion, but the integration into Emacs is naturally
    475   tight.
    476 
    477 - [[https://github.com/minad/consult][consult-completion-in-region]]: The Consult package provides the function
    478   ~consult-completion-in-region~ which can be set as ~completion-in-region-function~
    479   such that it handles ~completion-at-point~. The function works by transferring
    480   the in-buffer completion to the minibuffer. In the minibuffer, the minibuffer
    481   completion UI, for example [[https://github.com/minad/vertico][Vertico]] takes over. If you prefer to perform all
    482   your completions in the minibuffer ~consult-completion-in-region~ is your best
    483   option.
    484 
    485 * Contributions
    486 
    487 Since this package is part of [[http://elpa.gnu.org/packages/corfu.html][GNU ELPA]] contributions require a copyright
    488 assignment to the FSF.