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