cmc/cleberg.net

My personal web garden & blog.

clone: git clone https://gitbay.org/cmc/cleberg.net.git

main: content/blog/2026-02-02-emacs-carnival-2026-02-completion.org · raw

  1#+date:        [2026-02-02 Mon 18:40:21]
  2#+title:       Emacs Carnival: Completion
  3#+description: My response to the Emacs Carnival prompt for February 2026.
  4#+slug: emacs-carnival-2026-02-completion
  5#+filetags:    :emacs:personal:
  6
  7I'm having a great time with the Emacs Carnival, as it has inspired me to write
  8two posts in such a short time. It's been a much-needed inspiration to write
  9during my busy season at work.
 10
 11Anyway, let's get to it. The topic today is [[https://www.emacswiki.org/emacs/CategoryCompletion][Completion]]: the magical thing that
 12turns someone like me, who cannot remember long lists of commands to save my
 13life, from an illiterate to a literate programmer.
 14
 15* Defining Custom Abbreviations
 16
 17While you can define [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Abbrevs.html][abbrevs]] dynamically in the buffer with ~C-x a g~ (which
 18generally saves abbrevs to ~/.emacs.d/abbrev_defs~), I prefer to define my
 19abbreviations directly within my ~config.el~ file.
 20
 21This allows for better portability between my machines, as well as clearer
 22configuration for myself.
 23
 24To create a new abbrev, I simply open ~~/.config/doom/config.el~ and add a new one
 25to the list below.
 26
 27#+begin_src elisp
 28;; Abbreviations
 29(setq-default abbrev-mode t)
 30(define-abbrev-table 'global-abbrev-table
 31  '(
 32    ;; ("abbreviation" "expansion")
 33    ("omw" "on my way")
 34    ("eml" "hello@cleberg.net")
 35    ("shrg" "¯\_(ツ)_/¯")
 36    ("teh" "the")
 37    ("xtoday" "" (lambda () (insert (format-time-string "%Y-%m-%d %H:%M:%S"))))
 38    ("xnow" "" (lambda () (insert (format-time-string "%H:%M:%S"))))
 39    ))
 40#+end_src
 41
 42Now, I can type something like ~xtoday~ in my buffer and get the fully formatted
 43time string, like so: ~2026-02-02 21:52:55~.
 44
 45~¯\_(ツ)_/¯~
 46
 47This comes in handy most at work, where I need to constantly use acronyms and
 48take shorthand notes to fill out phrases that I'm, unfortunately, required to
 49reuse constantly. Looking at you, "completeness and accuracy of the data".
 50
 51* Doom Configuration
 52
 53I have played around with a few different completion options for my purposes and
 54have settled on the following packages.
 55
 56Here is how I have my ~:completion~, ~:tools~, and ~:lang~ modules toggled in
 57~~/.config/doom/init.el~:
 58
 59#+begin_src elisp
 60(doom! :input
 61       :completion
 62       (corfu +orderless)  ; complete with cap(f), cape and a flying feather!
 63       vertico             ; the search engine of the future
 64
 65        :checkers
 66       syntax              ; tasing you for every semicolon you forget
 67       (spell +flyspell)   ; tasing you for misspelling mispelling
 68       grammar             ; tasing grammar mistake every you make
 69
 70
 71       :tools
 72       (lsp +eglot)        ; M-x vscode
 73
 74       :lang
 75       data                ; config/data formats
 76       emacs-lisp          ; drown in parentheses
 77       json                ; At least it ain't XML
 78       javascript          ; all(hope(abandon(ye(who(enter(here))))))
 79       markdown            ; writing docs for people to ignore
 80       (org +dragndrop     ; drag & drop images/files into org
 81            +journal       ; daily logging
 82            +noter         ; for annotating PDFs (great for research)
 83            +roam2)        ; Zettelkasten note-taking
 84       python              ; beautiful is better than ugly
 85       sh                  ; she sells {ba,z,fi}sh shells on the C xor
 86
 87       :config
 88       (default +bindings +smartparens))
 89#+end_src
 90
 91With this setup, I am able to get a wonderful IDE-level experience within Emacs
 92and without the bloat of a traditional IDE. It's the perfect balance of speed
 93and power for my work and hobbies.
 94
 95** [[https://github.com/minad/vertico][vertico]] + [[https://github.com/minad/marginalia][marginalia]]
 96
 97Vertico is wonderful for finding files (~SPC .~) or running commands (~SPC :~). It
 98provides a clean, vertical interface for the minibuffer.
 99
100Marginalia works wonderfully with Vertico, as it provides marginalia to the
101minibuffer commands within the command selection buffer.
102
103#+caption: Vertico: Command
104[[https://img.cleberg.net/blog/20260202-emacs-carnival-2026-02-completion/vertico-commands.webp]]
105
106#+caption: Vertico: Files
107[[https://img.cleberg.net/blog/20260202-emacs-carnival-2026-02-completion/vertico-files.webp]]
108
109** [[https://github.com/oantolin/orderless][orderless]]
110
111Orderless is a game changer. As I mentioned above, I'm terrible with
112memorization. Therefore, I use this package and am able to search with multiple
113out-of-order terms to find a result in my Vertico searches.
114
115#+caption: Orderless
116[[https://img.cleberg.net/blog/20260202-emacs-carnival-2026-02-completion/orderless.webp]]
117
118** [[https://github.com/minad/corfu][corfu]]
119
120For code completion, I’ve swapped out Company mode for Corfu. It’s faster, stays
121out of my way until I need it, and uses a small popup that feels right at home
122in a terminal or a GUI.
123
124#+caption: Corfu
125[[https://img.cleberg.net/blog/20260202-emacs-carnival-2026-02-completion/python.webp]]
126
127** [[https://github.com/joaotavora/eglot][eglot]]
128
129To actually "know" what my code is doing, I use LSP (Language Server Protocol).
130I've enabled the ~+eglot~ flag in Doom because Eglot is now built into Emacs core
131and tends to be a bit more stable and performant for my Python and JavaScript
132workflows.
133
134** [[https://github.com/leotaku/flycheck-aspell?tab=readme-ov-file][flyspell]]
135
136Flyspell is the last piece to my puzzle, as it allows for easy help in
137correcting grammar errors within the buffer. I combine ~flyspell~ + ~syntax~ +
138~grammar~ for ultimate writing guidance. Whether or not I choose to follow that
139guidance is another story entirely.
140
141#+caption: Flyspell
142[[https://img.cleberg.net/blog/20260202-emacs-carnival-2026-02-completion/suggestions.webp]]
143
144* Looking Forward
145
146I know this is just the tip of the iceberg, so I've made a list of packages I
147want to dive into deeper in the future:
148
149- ~tempel~
150- ~yasnippet~
151- ~consult~
152- ~embark~
153- ~cape~
154- ~kind-icon~
155- ~prescient.el~
156
157Completion and expansion utilities are phenomenal and have been one of the
158larger tools in my development and writing.
159
160#+begin_quote
161Want to participate in the Emacs Carnival or read more posts? Visit the main
162[[https://www.emacswiki.org/emacs/Carnival][Carnival]] page on the Emacs Wiki to learn more.
163#+end_quote