CONFIG

Emacs Doom config

#OrgConfig #emacs
Published — Updated

Introduction

This is the config of a mostly-Vim user trying to use Emacs.

I might be getting the hang of Doom Emacs and its not-quite-Emacs-not-quite-Vim quirks.

I have no idea how well it will work.

config

See the Doom config example for extremely helpful inline comments, which I have impatiently stripped from my own config.

However, I know I’ll need this bit:

Here are some additional functions/macros that could help you configure Doom:

  • load! for loading external *.el files relative to this one
  • use-package! for configuring packages
  • after! for running code after a package has loaded
  • add-load-path! for adding directories to the load-path, relative to this file. Emacs searches the load-path when you load packages with require or use-package.
  • map! for binding new keys

To get information about any of these functions/macros, move the cursor over the highlighted symbol at press K (non-evil users must press C-c c k). This will open documentation for it, including demos of how they are used.

You can also try gd (or C-c c d) to jump to their definition and see how they are implemented.

;;; -*- lexical-binding: t; -*-

<<doom/define-personal-variables>>
<<doom/configure-aesthetics>>
<<doom/configure-projectile>>
<<doom/configure-org-mode>>
<<doom/configure-doom-dashboard>>

Personal variables and functions

Some are preferences, some are handy ways to define my environment.

(setq user-full-name "Brian Wisti"
      user-mail-address "brianwisti@pobox.com")

<<define-private-variables>>

And some are for work or personal details that we don’t need to be showing the public.

Fonts and aesthetics

These days I use Fantasque Sans for my code font. For themes I’m just going through emacs-doom-themes until I find a few that stick.

(setq doom-theme 'doom-acario-dark)
(setq display-line-numbers-type t)

(setq doom-font (font-spec :family "Fantasque Sans Mono Nerd Font" :size 16)
      doom-variable-pitch-font (font-spec :family "Ubuntu" :size 16)
      doom-big-font (font-spec :family "Fantasque Sans Mono Nerd Font" :size 26))

(after! doom-themes
  (setq doom-themes-enable-bold t
        doom-themes-enable-italic t))

Org mode

Honestly, Org mode is mostly what I use Emacs for.

(setq
 org-directory "~/org/"
 org-hide-emphasis-markers t  ;; conceal inline markup characters
 org-log-into-drawer t
 org-startup-indented t)

<<doom/configure-org-roam>>

Showing the Org Roam Graph

Allows org-roam to show its graph in the browser on macOS. Needs more configuration, but that’s a lower priority right now.

(use-package! org-roam
  :init
  (if IS-MAC
      (setq org-roam-graph-viewer "/usr/bin/open")))

Projectile

Projectile provides one approach to project management in Emacs.

(after! projectile
  (dolist (project my/projects)
    (projectile-add-known-project project)))

Doom Dashboard

  (setq +doom-dashboard-menu-sections
    '(("Reload last session"
      :icon (all-the-icons-octicon "history" :face 'doom-dashboard-menu-title)
      :when (cond ((require 'persp-mode nil t)
                    (file-exists-p (expand-file-name persp-auto-save-fname persp-save-dir)))
                  ((require 'desktop nil t)
                    (file-exists-p (desktop-full-file-name))))
      :face (:inherit (doom-dashboard-menu-title bold))
      :action doom/quickload-session)
      ("Open org-roam Daily"
       :icon (all-the-icons-octicon "squirrel" :face 'doom-dashboard-menu-title)
       :when (fboundp 'org-roam-dailies-find-today)
       :action org-roam-dailies-today)
      ("Open org-agenda"
      :icon (all-the-icons-octicon "calendar" :face 'doom-dashboard-menu-title)
      :when (fboundp 'org-agenda)
      :action org-agenda)
      ("Recently opened files"
      :icon (all-the-icons-octicon "file-text" :face 'doom-dashboard-menu-title)
      :action recentf-open-files)
      ("Open project"
      :icon (all-the-icons-octicon "briefcase" :face 'doom-dashboard-menu-title)
      :action projectile-switch-project)
      ("Jump to bookmark"
      :icon (all-the-icons-octicon "bookmark" :face 'doom-dashboard-menu-title)
      :action bookmark-jump)
      ("Open documentation"
      :icon (all-the-icons-octicon "book" :face 'doom-dashboard-menu-title)
      :action doom/help)))

init.el

The best use of init.el is just uncommenting entries from the extensive Doom init file for bundled packages you want enabled, and adding bundle options where relevant.

Again, grabbing a useful tip from the original:

Move your cursor over a module’s name (or its flags) and press ‘K’ (or ‘C-c c k’ for non-vim users) to view its documentation. This works on flags as well (those symbols that start with a plus).

Alternatively, press ‘gd’ (or ‘C-c c d’) on a module to browse its directory (for easy access to its source code).

packages.el

Nothing here yet, but this is where I would install packages beyond the plethora of options bundled with Doom.

And when I do hit that point, I may want to look at the Doom packages example.