DOOM Emacs

This an annotated version of my DOOM Emacs configuration. The source files can be found on Github or Sourcehut.



Black formatter

To allow formatting of Python blocks in org-mode and elsewhere, add python-black 1 to packages.el.

(package! python-black)

Then we configure it with

(use-package! python-black
  :after python
  :hook (python-mode . python-black-on-save-mode-enable-dwim))

We should install black-machiatto 2 to allow formatting of partial regions.


The following modules must be enabled in init.el:

  • (go +lsp) in the lang section
  • lsp in the tools section
  • snippets in the editor section

gopls should be installed.


To enable support of Go templates, install the lang/web packages by adding to init.el.

(web +html)

This will install the web-mode package3 To specify the sepcific template engine as Go M-x web-mode-set-engine to go.

Running doom sync will finish the setup.


Support for Pikchr4 is added via the pikchr-mode package. By adding

(package! pikchr-mode)

It is necessary to install the pikchr binary according to the instructions in Pikchr. That page also contains examples.


Prettify symbols

Since Emacs 24.45 there is a builtin prettify-symbols-mode. It can be customized by changing prettify-symbols-alist. These strings will be replace by our selection, typically an unicode symbol. In this configuration we use the following:

(defun my/pretty-symbols ()
  (setq prettify-symbols-alist
          '(("#+begin_src python" . "🐍")
            ("#+begin_src elisp" . "λ")
            ("#+begin_src jupyter-python" . "🐍")
            ("#+end_src" . "―")
            ("#+results:" . "🔨")
            ("#+RESULTS:" . "🔨"))))

This will, for instance, replace the beginning of Python org-babel blocks with the single symbol. To register the prettify list with each mode we use

(add-hook 'org-mode-hook 'my/pretty-symbols)

Or we can register the prettify-symbols-mode as a global mode

(global-prettify-symbols-mode +1)


Beacon highlights the current cursor line after major movements. Especially useful for HDPi screens. Add it on packages.el:

  (package! beacon)

And enable the global minor-mode on config.el with:

  ;; global beacon minor-mode
  (use-package! beacon)
  (after! beacon (beacon-mode 1))


This mode relies on the Focus package that dims regions not on … focus. Since the package is on MELPA, it can be installed by adding to packages.el:

  (package! focus)

Next, require it from config.el

  (use-package! focus)

And call it by setting the mode with M-x focus-mode.


Dirvish offers a suitable replacement/enhancement for dired with features such as improved UI and image preview. The only requirement for dirvish is the ls alternative exa It is available from MELPA which means you can add it to packages.el with

(package! dirvish)

and then enable it on config.el with

(use-package! dirvish)



An interesting talk on the advantages of using vterm as the default Emacs terminal emulator can be found can found at EmacsConf 2021A Tour of vterm”. To use vterm as the Emacs shell, the respective section in init.el should be selected:

 ;;eshell            ; the elisp shell that works everywhere
 ;;shell             ; simple shell REPL for Emacs
 ;;term              ; basic terminal emulator for Emacs
 vterm             ; the best terminal emulation in Emacs

We also need to install libvterm, with in macOS can be done with

brew install libvterm

and in Linux with

$ sudo apt-get install -y libvterm-dev # Ubuntu
$ sudo dnf -y install libvterm # Fedora

  1. ↩︎

  2. ↩︎

  3. ↩︎

  4. ↩︎

  5. ↩︎