refactor: distribute module declarations through config

This makes the codebase much easier to maintain, and also prevents the
reader from having to scroll past a giant wall of module declarations.
This commit is contained in:
Kiana Sheibani 2025-10-30 11:47:32 -04:00
parent 5395c5b7d2
commit d454033af9
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -874,270 +874,97 @@ One of Doom Emacs's most useful features is its modular configuration system, al
#+begin_src emacs-lisp :tangle init.el :noweb no-export :exports none #+begin_src emacs-lisp :tangle init.el :noweb no-export :exports none
;;; init.el -*- lexical-binding: t; -*- ;;; init.el -*- lexical-binding: t; -*-
(doom! <<doom-input>> (doom!
<<doom-module>>
)
#+end_src
<<doom-completion>> Modules are enabled by specifying a module category (a keyword, like =:editor=), a module name, and optional configuration flags. For example, since this is a literate config, the corresponding module must be enabled:
<<doom-ui>> #+begin_src emacs-lisp :noweb-ref doom-module
:config literate
#+end_src
<<doom-editor>> Most modules will be enabled alongside the sections they are configured below, but here we will set some self-explanatory base modules.
<<doom-emacs>> ** Doom Core Modules
<<doom-term>> These UI modules contain core parts of Doom Emacs's structure and are highly recommended.
<<doom-checkers>> #+begin_src emacs-lisp :noweb-ref doom-module
:ui
doom
doom-dashboard
modeline
workspaces
#+end_src
<<doom-tools>> ** Evil
<<doom-os>> #+begin_src emacs-lisp :noweb-ref doom-module
:editor (evil +everywhere)
<<doom-lang>>
<<doom-email>>
<<doom-app>>
<<doom-config>>
)
#+end_src #+end_src
** Config Modules ** Config Modules
Since this is a literate config, the corresponding ~:config literate~ module is necessary. We'll also turn on some of the default config options too. #+begin_src emacs-lisp :noweb-ref doom-module
#+name: doom-config
#+begin_src emacs-lisp
:config :config
literate
(default +bindings +smartparens) (default +bindings +smartparens)
#+end_src #+end_src
** Completion ** Completion
I'm a big fan of the Vertico ecosystem, as it's lightweight and easy to use. Let's turn on that module, along with Corfu for a nice in-buffer completion popup and some icons because why not. #+begin_src emacs-lisp :noweb-ref doom-module
#+name: doom-completion
#+begin_src emacs-lisp
:completion :completion
(vertico +icons) (vertico +icons)
(corfu +icons +orderless)
#+end_src #+end_src
** Checkers ** Other Modules
The two most common syntax checking engines seem to be =flymake= and =flycheck=. =flymake= is built in to Emacs, is generally faster and currently has better support in the ecosystem, so let's use that one.
In the past I used Doom Emacs's ~spell~ checker as well, but I eventually switched to a different system for spell-checking.
#+name: doom-checkers
#+begin_src emacs-lisp
:checkers
(syntax +flymake +childframe)
(spell +aspell)
;;grammar
#+end_src
** UI
Most of these are either defaults that come with Doom Emacs or just recommended, but here are the highlights:
- ~vi-tilde-fringe~ because I like how it looks - ~vi-tilde-fringe~ because I like how it looks
- ~file-templates~ and ~snippets~ because typing is hard
- ~(format +onsave)~ because I don't want to have to remember to run a formatter - ~(format +onsave)~ because I don't want to have to remember to run a formatter
- ~direnv~ because I'm a nix user - ~direnv~ because I'm a nix user
- Icons!
#+name: doom-ui #+begin_src emacs-lisp :noweb-ref doom-module
#+begin_src emacs-lisp
:ui :ui
deft deft
doom
doom-dashboard
;;doom-quit
;;(emoji +unicode) ;;(emoji +unicode)
hl-todo hl-todo
;;hydra
indent-guides indent-guides
;;ligatures ;;ligatures
;;minimap ;;minimap
modeline
;;nav-flash
;;neotree
ophints
(popup +defaults) (popup +defaults)
smooth-scroll smooth-scroll
;;tabs
;;(treemacs +lsp)
unicode unicode
(vc-gutter +pretty) (vc-gutter +pretty)
vi-tilde-fringe vi-tilde-fringe
(window-select +numbers)
workspaces
;;zen
#+end_src
#+name: doom-editor
#+begin_src emacs-lisp
:editor :editor
(evil +everywhere)
file-templates
fold fold
(format +onsave) (format +onsave)
;;god
;;lispy
;;multiple-cursors
;;objed
;;parinfer
;;rotate-text
snippets
(whitespace +guess +trim) (whitespace +guess +trim)
word-wrap
#+end_src
#+name: doom-tools
#+begin_src emacs-lisp
:tools :tools
;;ansible
biblio biblio
;;collab
debugger debugger
direnv direnv
;;docker editorconfig
;;editorconfig
;;ein
(eval +overlay) (eval +overlay)
;;gist (lookup +dictionary +docsets)
(lookup +docsets)
lsp
(magit +forge)
make make
pass
pdf pdf
;;prodigy
;;rgb
;;terraform
tree-sitter
;;tmux
;;upload ;;upload
#+end_src
#+name: doom-emacs
#+begin_src emacs-lisp
:emacs :emacs
(dired +dirvish +icons)
electric electric
(ibuffer +icons) (ibuffer +icons)
(undo +tree)
vc vc
#+end_src
#+name: doom-os
#+begin_src emacs-lisp
:os :os
tty tty
#+end_src #+end_src
** Apps *** TODO Move these to separate config sections
Who doesn't love doing everything in Emacs?
#+name: doom-term
#+begin_src emacs-lisp
:term
vterm
#+end_src
#+name: doom-email
#+begin_src emacs-lisp
:email
(mu4e +org +gmail)
#+end_src
#+name: doom-app
#+begin_src emacs-lisp
:app
calendar
;;emms
everywhere
;;irc
;;(rss +org) ; One day...
;;twitter
#+end_src
** Language Modules
Doom Emacs provides a large collection of modules for different languages. Which is good, because setting up language mode packages is kind of annoying.
#+name: doom-lang
#+begin_src emacs-lisp
:lang
(agda +tree-sitter)
;;beancount
(cc +lsp +tree-sitter)
;;clojure
;;common-lisp
;;coq
;;crystal
;;csharp
data
;;(dart +flutter)
dhall
;;elixir
;;elm
emacs-lisp
;;erlang
;;ess
;;factor
;;faust
;;fortran
;;fsharp
;;fstar
;;gdscript
;;(go +lsp)
;;(graphql +lsp)
(haskell +lsp)
;;hy
idris
;;json
(java +lsp +tree-sitter)
;;javascript
;;julia
;;kotlin
(latex +lsp)
;;lean
;;ledger
;;lua
markdown
;;nim
(nix +lsp +tree-sitter)
;;ocaml
(org +roam +present
+gnuplot +jupyter
+pandoc +journal +pretty)
;;php
;;plantuml
;;purescript
(python +lsp +tree-sitter)
(qt +lsp +tree-sitter)
;;racket
;;raku
;;rest
;;rst
;;(ruby +rails)
(rust +lsp +tree-sitter)
(scala +lsp +tree-sitter)
;;(scheme +guile)
(sh +fish +lsp +tree-sitter)
;;sml
;;solidity
;;swift
;;terra
(web +lsp +tree-sitter)
yaml
;;zig
#+end_src
* Basic Configuration * Basic Configuration
@ -1431,6 +1258,10 @@ Some other small aesthetic changes:
#+call: confpkg("Line Wrapping") #+call: confpkg("Line Wrapping")
#+begin_src emacs-lisp :noweb-ref doom-module
:editor word-wrap
#+end_src
I have rather specific tastes when it comes to line wrapping. I like soft line wrapping (~visual-line-mode~), but I want it to be as seamless as possible. I have rather specific tastes when it comes to line wrapping. I like soft line wrapping (~visual-line-mode~), but I want it to be as seamless as possible.
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -1561,6 +1392,10 @@ Now that we've enabled our preferred modules and done some basic configuration,
#+call: confpkg("Pkg: corfu") #+call: confpkg("Pkg: corfu")
#+begin_src emacs-lisp :noweb-ref doom-module
:completion (corfu +icons +orderless)
#+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
(after! corfu (after! corfu
;; I don't really use TAB very often, so prefer other actions ;; I don't really use TAB very often, so prefer other actions
@ -2046,7 +1881,13 @@ While we're here, we'll also set my preferred =evil-escape= keys:
#+call: confpkg("Pkg: flymake") #+call: confpkg("Pkg: flymake")
I really like Flycheck's double-arrow fringe indicator, so let's quickly steal that: #+begin_src emacs-lisp :noweb-ref doom-module
:checkers (syntax +flymake +childframe)
#+end_src
The two most common syntax checking engines seem to be =flymake= and =flycheck=. =flymake= is built in to Emacs, is generally faster and currently has better support in the ecosystem, so I'll use that one.
I really like =flycheck='s double-arrow fringe indicator, though, so let's quickly steal that:
#+begin_src emacs-lisp #+begin_src emacs-lisp
(after! flymake (after! flymake
@ -2120,6 +1961,10 @@ Let's also increase the maximum length of commit summaries from 50 to 60 charact
*** Forge *** Forge
#+begin_src emacs-lisp :noweb-ref doom-module
:tools (magit +forge)
#+end_src
Forge is a convenient package for working with remote code forges like GitHub, GitLab, etc. These days, I've mostly switched over to my own [[https://git.tokinanpa.dev/][personal forge]] instead of those more public options, so I'll need to let Forge know about that. Forge is a convenient package for working with remote code forges like GitHub, GitLab, etc. These days, I've mostly switched over to my own [[https://git.tokinanpa.dev/][personal forge]] instead of those more public options, so I'll need to let Forge know about that.
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -2157,6 +2002,10 @@ These new categories can then be used to define [[*Keymaps][Embark keymaps]] for
** Operation Hints ** Operation Hints
#+begin_src emacs-lisp :noweb-ref doom-module
:ui ophints
#+end_src
I like having ophints for vim editing so that I don't get lost when making large edits, but the =ophints= module in Doom doesn't look very good to me (it gets rid of pulses and color), so I'll override it. I like having ophints for vim editing so that I don't get lost when making large edits, but the =ophints= module in Doom doesn't look very good to me (it gets rid of pulses and color), so I'll override it.
#+begin_src emacs-lisp :tangle modules/ui/ophints/packages.el #+begin_src emacs-lisp :tangle modules/ui/ophints/packages.el
@ -2208,6 +2057,10 @@ I like having ophints for vim editing so that I don't get lost when making large
#+call: confpkg("Pkg: yasnippet") #+call: confpkg("Pkg: yasnippet")
#+begin_src emacs-lisp :noweb-ref doom-module
:editor snippets
#+end_src
Snippets are a sophisticated method of warding off the scourge of unnecessary keystrokes. They were a bit hard to get used to, but I've warmed up to them over time. Snippets are a sophisticated method of warding off the scourge of unnecessary keystrokes. They were a bit hard to get used to, but I've warmed up to them over time.
The snippets themselves are stored in separate files, each of which can be found in the =snippets/= subdirectory of this repo. As the ~yasnippet~ package expects, they are grouped by major mode. The snippets themselves are stored in separate files, each of which can be found in the =snippets/= subdirectory of this repo. As the ~yasnippet~ package expects, they are grouped by major mode.
@ -2281,9 +2134,13 @@ be prompted for the mode for which to create the snippet."
*** File Templates *** File Templates
#+begin_src emacs-lisp :noweb-ref doom-module
:editor file-templates
#+end_src
Doom's =file-templates= module extends =yasnippet= to provide a nice file template system. The idea is simple: the variable ~+file-templates-alist~ maps file predicates to snippets. If a file that matches a predicate is created, the corresponding snippet is automatically expanded inside of it. Doom's =file-templates= module extends =yasnippet= to provide a nice file template system. The idea is simple: the variable ~+file-templates-alist~ maps file predicates to snippets. If a file that matches a predicate is created, the corresponding snippet is automatically expanded inside of it.
This system works well for the most part, but there's a serious issue with its UI: the function that registers file templates, ~set-file-templates!~, takes a plist to configure the template. If this list is empty, an existing template is removed instead. This is not only unintuitive, but it prevents you from having an empty property list, which is often necessary! We'll patch the function to remove this issue with a =:remove= key, as well as to have templates appended to the alist instead of prepended to make the order of templates more clear. This system works well for the most part, but there's a serious issue with its UI: the function that registers file templates, ~set-file-templates!~, takes a plist to configure the template. If this list is empty, an existing template is removed instead. This is not only unintuitive, but it prevents you from having an empty property list, which is often necessary! We'll patch the function to resolve this issue with a =:remove= key, as well as to have templates appended to the alist instead of prepended to make the order of templates more clear.
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; HACK: Force templates function to load ;; HACK: Force templates function to load
@ -2325,13 +2182,18 @@ The default Nix file template is for a NixOS module. This is nice when you're wr
#+call: confpkg("Pkg: ispell") #+call: confpkg("Pkg: ispell")
Keeping with its general theme of flexibility at the cost of pain, Emacs's spell-checking functionality requires several different packages to be installed, as well as an external spell-checking program to interface with. Let's set all these up in order: #+begin_src emacs-lisp :noweb-ref doom-module
:checkers (spell +aspell)
#+end_src
Keeping with its general theme of flexibility at the cost of pain, Emacs's spell-checking functionality requires several different packages to be installed, as well as an external spell-checking program to interface with. Let's set all these up, one after another:
*** Aspell *** Aspell
The recommended external spell-checker is GNU Aspell, which takes a dictionary of words in a particular language and uses it to spell-check a text file. The default English dictionary is named =en_US=; I've created my own dictionary file based on it named =en_US-custom= with Aspell's multi-dictionary feature. The recommended external spell-checker is GNU Aspell, which takes a dictionary of words in a particular language and uses it to spell-check a text file. The default English dictionary is named =en_US=; I've created my own dictionary file based on it named =en_US-custom= with Aspell's multi-dictionary feature.
#+begin_src sh #+begin_src sh :eval nodf:w
# en_US-custom.multi # en_US-custom.multi
add en_US-w_accents.multi add en_US-w_accents.multi
add en-computers.rws add en-computers.rws
@ -2363,7 +2225,7 @@ We then also need a plain-text dictionary for certain features, like spelling co
(setq ispell-alternate-dictionary ~/plaintext-dict) (setq ispell-alternate-dictionary ~/plaintext-dict)
#+end_src #+end_src
Ispell also manages our personal dictionary, which it places in a reasonable default position. Ispell also manages our personal dictionary, which is placed in a reasonable default position.
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; Don't ask for confirmation to save to personal dictionary ;; Don't ask for confirmation to save to personal dictionary
@ -2386,21 +2248,47 @@ We now have spelling correction working, but no spelling completion. The package
(add-hook! 'completion-at-point-functions :local :depth 40 #'cape-dict)) (add-hook! 'completion-at-point-functions :local :depth 40 #'cape-dict))
#+end_src #+end_src
** Tree-Sitter
#+call: confpkg("Pkg: tree-sitter")
#+begin_src emacs-lisp :noweb-ref doom-module
:tools tree-sitter
#+end_src
#+begin_src emacs-lisp :noweb-ref doom-module-top
;; Globally enable +tree-sitter flag
+tree-sitter
#+end_src
The =tree-sitter= built-in Emacs package provides integration with the programming language parser of the same name, allowing for IDE features associated with parsing programs to be much faster.
** Undo Tree ** Undo Tree
#+call: confpkg("Pkg: undo-tree") #+call: confpkg("Pkg: undo-tree")
#+begin_src emacs-lisp :noweb-ref doom-module
:emacs (undo +tree)
#+end_src
I don't like the default placement of =undo-tree= on the left side of the window, as it takes up the same space as the project tree. Let's move it to the right side.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(after! undo-tree (after! undo-tree
(setq undo-tree-visualizer-diff nil)) (setq undo-tree-visualizer-diff nil))
(set-popup-rule! "^ \\*undo-tree\\*" :slot 2 :side 'right :size 30 :select t :quit nil) (set-popup-rule! "^ \\*undo-tree\\*"
:slot 2 :side 'right :size 30 :select t :quit nil)
#+end_src #+end_src
** VTerm ** VTerm
#+call: confpkg("Pkg: vterm") #+call: confpkg("Pkg: vterm")
#+begin_src emacs-lisp :noweb-ref doom-module
:term vterm
#+end_src
I've set my default Emacs shell to =bash=, since pointing Emacs to a non-POSIX shell like =fish= (my usual default) can cause incompatibility issues. I still want to use =fish= for my own purposes, though, so we'll set it as the shell in ~vterm~: I've set my default Emacs shell to =bash=, since pointing Emacs to a non-POSIX shell like =fish= (my usual default) can cause incompatibility issues. I still want to use =fish= for my own purposes, though, so we'll set it as the shell in ~vterm~:
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -2412,6 +2300,10 @@ I've set my default Emacs shell to =bash=, since pointing Emacs to a non-POSIX s
#+call: confpkg("Pkg: winum") #+call: confpkg("Pkg: winum")
#+begin_src emacs-lisp :noweb-ref doom-module
:ui (window-select +numbers)
#+end_src
Emacs comes with a few standard commands for selecting different windows. These are mostly directional, allowing you to move your selection up, right, left or down from the current window. This is a bit inconvenient when there are a lot of windows, so the =winum= package allows you to assign a number to each window to make navigation easier. Emacs comes with a few standard commands for selecting different windows. These are mostly directional, allowing you to move your selection up, right, left or down from the current window. This is a bit inconvenient when there are a lot of windows, so the =winum= package allows you to assign a number to each window to make navigation easier.
There's just one wrinkle: Doom Emacs's popup management system. Popups are treated as separate from "real" windows, usually displayed on the edge of the frame and without a modeline. =winum= has no knowledge of popup windows and assigns them numbers exactly the same as any other window. This can get really confusing, since windows get renumbered every time a new popup appears. There's just one wrinkle: Doom Emacs's popup management system. Popups are treated as separate from "real" windows, usually displayed on the edge of the frame and without a modeline. =winum= has no knowledge of popup windows and assigns them numbers exactly the same as any other window. This can get really confusing, since windows get renumbered every time a new popup appears.
@ -2628,6 +2520,10 @@ Some of Calc's default modes are a little baffling. (I don't know why any modern
#+call: confpkg() #+call: confpkg()
#+begin_src emacs-lisp :noweb-ref doom-module
:app calendar
#+end_src
The calendar's main purpose for me is to give a better view of the [[*Agenda][Org agenda]]. The calendar's main purpose for me is to give a better view of the [[*Agenda][Org agenda]].
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -2649,6 +2545,10 @@ The calendar's main purpose for me is to give a better view of the [[*Agenda][Or
#+call: confpkg("Emacs Everywhere") #+call: confpkg("Emacs Everywhere")
#+begin_src emacs-lisp :noweb-ref doom-module
:app everywhere
#+end_src
Emacs Everywhere is a great idea. Unfortunately, the default package on MELPA uses X-based window commands, while I use Hyprland, which is Wayland-based. To fix this issue, we need to override some of the package's variables and functions. Emacs Everywhere is a great idea. Unfortunately, the default package on MELPA uses X-based window commands, while I use Hyprland, which is Wayland-based. To fix this issue, we need to override some of the package's variables and functions.
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -2694,6 +2594,10 @@ Emacs Everywhere is a great idea. Unfortunately, the default package on MELPA us
#+call: confpkg() #+call: confpkg()
#+begin_src emacs-lisp :noweb-ref doom-module
:email (mu4e +org +gmail)
#+end_src
I use =isync=, =msmtp= and =mu= as Doom Emacs recommends. I use =isync=, =msmtp= and =mu= as Doom Emacs recommends.
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -2721,6 +2625,10 @@ I use =isync=, =msmtp= and =mu= as Doom Emacs recommends.
#+call: confpkg("Pass") #+call: confpkg("Pass")
#+begin_src emacs-lisp :noweb-ref doom-module
:tools pass
#+end_src
I use the standard Unix-style password management system, [[https://www.passwordstore.org/][pass]]. I use the standard Unix-style password management system, [[https://www.passwordstore.org/][pass]].
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -2781,6 +2689,13 @@ When visiting a password file, the file's buffer replaces the pass buffer, which
#+call: confpkg() #+call: confpkg()
#+begin_src emacs-lisp :noweb-ref doom-module
:lang
(org +roam +present
+gnuplot +jupyter
+pandoc +journal +pretty)
#+end_src
I love ~org-mode~. In fact, I love it so much that I'm willing to give it its own top-level section in this config! Its power and flexibility are unmatched by any other productivity/organization tool I've ever used. Much like Emacs itself, all alternatives simply vanish. I love ~org-mode~. In fact, I love it so much that I'm willing to give it its own top-level section in this config! Its power and flexibility are unmatched by any other productivity/organization tool I've ever used. Much like Emacs itself, all alternatives simply vanish.
Unfortunately, with that power comes a *lot* of configuration work up-front. It was completely worth it for me when I made it out the other end, but that doesn't mean everyone would have the time or patience to make it work. Unfortunately, with that power comes a *lot* of configuration work up-front. It was completely worth it for me when I made it out the other end, but that doesn't mean everyone would have the time or patience to make it work.
@ -3973,13 +3888,33 @@ To make opening the journal more convenient, here's a command to open the latest
* Languages and Modes * Languages and Modes
This is the configuration for all the mode-related packages, including programming language packages. Most of this is configuring packages to work with my preferred Nix-based development environment. This is the configuration for all the mode-related packages, including programming language packages. Most of these are going to be simply enabling the corresponding Doom module, as major modes don't tend to involve much configuration.
** Agda
#+call: confpkg("Mode: Agda")
#+begin_src emacs-lisp :noweb-ref doom-module
:lang (agda +lsp +tree-sitter)
#+end_src
** C Family
#+call: confpkg("Mode: C")
#+begin_src emacs-lisp :noweb-ref doom-module
:lang (cc +lsp +tree-sitter)
#+end_src
** Dirvish ** Dirvish
#+call: confpkg("Mode: Dirvish") #+call: confpkg("Mode: Dirvish")
~dirvish~ is a drop-in replacement to Emacs's native ~dired~ that adds a bunch of useful features and customization, inspired by vim's =ranger=. The package is provided by Doom Emacs's =:emacs dired= module, so we just need to configure it. #+begin_src emacs-lisp :noweb-ref doom-module
:emacs (dired +icons +dirvish)
#+end_src
~dirvish~ is a drop-in replacement to Emacs's native ~dired~ that adds a bunch of useful features and customization, inspired by Vim's =ranger=. The package is provided by Doom Emacs's =:emacs dired= module, so we just need to configure it.
*** Switching Projects *** Switching Projects
@ -4088,21 +4023,45 @@ If a side session is open, we'll configure =winum= to give it the index ~(popup\
(push #'~/winum-dirvish-side winum-assign-functions)) (push #'~/winum-dirvish-side winum-assign-functions))
#+end_src #+end_src
** Emacs Lisp
#+call: confpkg("Mode: Emacs Lisp")
#+begin_src emacs-lisp :noweb-ref doom-module
:lang emacs-lisp
#+end_src
** Haskell ** Haskell
#+call: confpkg("Mode: Haskell") #+call: confpkg("Mode: Haskell")
#+begin_src emacs-lisp :noweb-ref doom-module
:lang (haskell +lsp +tree-sitter)
#+end_src
Operators being in italics looks ugly, so let's fix that. Operators being in italics looks ugly, so let's fix that.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(custom-set-faces! '(haskell-operator-face :slant normal)) (custom-set-faces! '(haskell-operator-face :slant normal))
#+end_src #+end_src
** HTML + CSS
#+call: confpkg("Mode: Web")
#+begin_src emacs-lisp :noweb-ref doom-module
:lang (web +lsp +tree-sitter)
#+end_src
** Idris ** Idris
:PROPERTIES: :PROPERTIES:
:header-args:emacs-lisp: :noweb-ref idris-config :header-args:emacs-lisp: :noweb-ref idris-config
:END: :END:
#+begin_src emacs-lisp :noweb-ref doom-module
:lang idris
#+end_src
Idris's support for Emacs is still experimental and has a few kinks to work out, especially since I'm using Idris 2, which the recommended =idris-mode= needs to be configured to use. Idris's support for Emacs is still experimental and has a few kinks to work out, especially since I'm using Idris 2, which the recommended =idris-mode= needs to be configured to use.
The Doom module is very outdated, so I'll be overriding it. The Doom module is very outdated, so I'll be overriding it.
@ -4132,8 +4091,6 @@ The Doom module is very outdated, so I'll be overriding it.
idris-repl-show-repl-on-startup nil ; Don't show repl on startup idris-repl-show-repl-on-startup nil ; Don't show repl on startup
) )
;; (add-hook! idris-mode :append #'lsp!)
(set-repl-handler! 'idris-mode (cmd! (idris-repl-buffer))) (set-repl-handler! 'idris-mode (cmd! (idris-repl-buffer)))
(set-lookup-handlers! 'idris-mode (set-lookup-handlers! 'idris-mode
:documentation #'idris-docs-at-point) :documentation #'idris-docs-at-point)
@ -4195,6 +4152,10 @@ I prefer 2-space indentation in all circumstances. Unfortunately, Emacs's indent
#+call: confpkg("Mode: Java") #+call: confpkg("Mode: Java")
#+begin_src emacs-lisp :noweb-ref doom-module
:lang (java +lsp +tree-sitter)
#+end_src
The =lsp-java= package provides LSP support using the standard Java language server, the Eclipse server ~jdtls~. Unfortunately, this package isn't designed for Nix, so it fails to find the server script in our Nix store. We need to do a bit of legwork to patch in this support, as well as some related considerations, such as per-project config directories. The =lsp-java= package provides LSP support using the standard Java language server, the Eclipse server ~jdtls~. Unfortunately, this package isn't designed for Nix, so it fails to find the server script in our Nix store. We need to do a bit of legwork to patch in this support, as well as some related considerations, such as per-project config directories.
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -4237,6 +4198,10 @@ Doom's standard library allows for an empty =.project= file to mark the root of
#+call: confpkg("Mode: LSP") #+call: confpkg("Mode: LSP")
#+begin_src emacs-lisp :noweb-ref doom-module
:tools lsp
#+end_src
The emacs package =lsp-mode= is the package of choice for general LSP integration in Emacs. The Doom Emacs module =:tools lsp= handles most of the configuration for it, but there's one annoyance it doesn't cover: when a server isn't found for a particular language, =lsp-mode= tries to install it itself, which is a complete waste of time for my purposes since I use NixOS. The emacs package =lsp-mode= is the package of choice for general LSP integration in Emacs. The Doom Emacs module =:tools lsp= handles most of the configuration for it, but there's one annoyance it doesn't cover: when a server isn't found for a particular language, =lsp-mode= tries to install it itself, which is a complete waste of time for my purposes since I use NixOS.
There is luckily a configuration variable to disable this suggestion: There is luckily a configuration variable to disable this suggestion:
@ -4256,10 +4221,22 @@ Some more convenient leader key bindings would be nice to prevent having to traw
"c L" #'lsp-avy-lens) "c L" #'lsp-avy-lens)
#+end_src #+end_src
** Latex
#+call: confpkg("Mode: Latex")
#+begin_src emacs-lisp :noweb-ref doom-module
:lang (latex +lsp)
#+end_src
** Markdown ** Markdown
#+call: confpkg("Mode: Markdown") #+call: confpkg("Mode: Markdown")
#+begin_src emacs-lisp :noweb-ref doom-module
:lang (markdown +tree-sitter)
#+end_src
*** Polymode *** Polymode
Markdown allows for inserting code from other languages into itself. To make this integration more seamless, we can use the =poly-markdown= package to add syntax highlighting and major mode features of the corresponding language to the buffer. Markdown allows for inserting code from other languages into itself. To make this integration more seamless, we can use the =poly-markdown= package to add syntax highlighting and major mode features of the corresponding language to the buffer.
@ -4291,6 +4268,63 @@ The Agda integration with Markdown specifically requires some changes to the pol
(assq-delete-all 'background agda2-highlight-faces))) (assq-delete-all 'background agda2-highlight-faces)))
#+end_src #+end_src
** Markup/Data Formats
#+call: confpkg("Mode: Markup")
#+begin_src emacs-lisp :noweb-ref doom-module
:lang data (yaml +lsp +tree-sitter)
#+end_src
** Nix
#+call: confpkg("Mode: Nix")
#+begin_src emacs-lisp :noweb-ref doom-module
:lang (nix +lsp +tree-sitter)
#+end_src
** Python
#+call: confpkg("Mode: Python")
#+begin_src emacs-lisp :noweb-ref doom-module
:lang (python +lsp +tree-sitter)
#+end_src
** Qt
#+call: confpkg("Mode: Qt")
#+begin_src emacs-lisp :noweb-ref doom-module
:lang (qt +lsp +tree-sitter)
#+end_src
** Rust
#+call: confpkg("Mode: Rust")
#+begin_src emacs-lisp :noweb-ref doom-module
:lang (rust +lsp +tree-sitter)
#+end_src
** Scala
#+call: confpkg("Mode: Scala")
#+begin_src emacs-lisp :noweb-ref doom-module
:lang (scala +lsp +tree-sitter)
#+end_src
** Shell Scripts
#+call: confpkg("Mode: Sh")
#+begin_src emacs-lisp :noweb-ref doom-module
:lang (sh +lsp +fish)
#+end_src
** Slint ** Slint
#+call: confpkg("Mode: Slint") #+call: confpkg("Mode: Slint")