Emacs 30 Built-in Completion UI & Styles
Video notes:
- When referring to “Emacs Completions”, I refer to Completion Styles & UI
- I’ve often relied on third-party packages to emulate features from
other text editors. For instance, I’ve long used
vertico,corfuandorderless.- While I still recommend these packages, I became curious about using Emacs without depending on third-party options.
- My current setup tries to emulate my workflow with the packages mentioned above.
- The catalyst that pushed me to try the built-in completion is the
addition of
completion-preview-modein Emacs 30.
Mini-buffer completions
- Emacs does not enable “vertical” completions for the mini-buffer by
default, but you can enable
fido-vertical-modewhich comes built-in with Emacs.fido-modeis an enhancedicomplete-modethat emulatesido-mode, also referred to asfake ido-mode.
Completion Styles
- Changing
completion-stylesexample:
(setf completion-styles '(basic flex))
- There is a plethora of completion styles, builtin styles include
flex, which provides “fuzzy” completions.
Completion UI & Code completions
- Emacs built-in completions have a distinctive approach.
- Instead of displaying a popup at point, a new Completions buffer
appears when invoking
completion-at-point.
Example configuration:
(setf completion-styles '(basic flex)
completion-auto-select t ;; Show completion on first call
completion-auto-help 'visible ;; Display *Completions* upon first request
completions-format 'one-column ;; Use only one column
completions-sort 'historical ;; Order based on minibuffer history
completions-max-height 20 ;; Limit completions to 15 (completions start at line 5)
completion-ignore-case t)