/doomConfig

Repo for my emacs in case I make a fatal blunder

Primary LanguageEmacs LispGNU General Public License v3.0GPL-3.0

Emacs-Config

Table of Contents

User Information

My name and email address. Currently, I don’t have an email client for emacs set up but this would be useful then

(setq user-full-name "Calvin Roth"
      user-mail-address "rothx195@umn.edu")

Doom exposes five (optional) variables for controlling fonts in Doom. Here are the three important ones:

  • `doom-font’
  • `doom-variable-pitch-font’
  • `doom-big-font’ – used for `doom-big-font-mode’; use this for presentations or streaming

They all accept either a font-spec, font string (“Input Mono-12”), or xlfd font string. You generally only need these two: (setq doom-font (font-spec :family “monospace” :size 12 :weight ‘semi-light) doom-variable-pitch-font (font-spec :family “sans” :size 13))

Appearance

There are two ways to load a theme. Both assume the theme is installed and available. You can either set `doom-theme’ or manually load a theme with the `load-theme’ function. To preview other themes press SPACE+h+t.

Theme

(setq doom-theme 'doom-one)

Line Numbers

This determines the style of line numbers in effect. If set to `nil’, line numbers are disabled. For relative line numbers(meaning distance from current line), set this to `relative’.

(setq display-line-numbers-type `relative)

Start up setting

Start emacs in full screen

(add-hook 'window-setup-hook 'toggle-frame-fullscreen t)

Font Settings

Next make the font size bigger. Also change font here

(set-face-attribute 'default nil :height 200)

Emoji Settings

Finally, we set the style of emoji we want to use. Here we use the twitter style

(setq emojify-emoji-set "twemoji-v2")

Org Mode

If you use `org’ and don’t want your org files in the default location below, change `org-directory’. It must be set before org loads!

General org mode

First, we turn on toggle pretty entities this turns simple math into the appropriate symbol. For example, epsilon becomes ε and to becomes → . In general, use latex rules, in particular math commands start with a slash \ normally. Super/subscripts work now too.

(after! org
  (setq org-pretty-entities t)
)

We will also hide emphasis markers. In org mode / + text + / with no spaces for the slashes yields italtic text: text and likewise for Bold Text using the * symbol. This command hides the slashes and stars.

(after! org
  (setq org-hide-emphasis-markers t)
)

Directories

(after! org
  (setq org-directory "~/org/")
  (setq org-agenda-files "/org/weekly.org")
)

TOOD lists and bullets

This makes it so when all the children of a TOOD item are DONE then the parent is automatically marked as done

(defun org-summary-todo (n-done n-not-done)
  "Switch entry to DONE when all subentries are done, to TODO otherwise."
  (let (org-log-done org-log-states)   ; turn off logging
    (org-todo (if (= n-not-done 0) "DONE✅" "TODO🌊"))))
    ;; I included the statistics here.
(add-hook 'org-after-todo-statistics-hook 'org-summary-todo)

This package is for prettier bullets

(after! org
  (use-package! org-bullets
      :config
      (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
)

Just as the org bullet packages redefine the bullets for headings, I define the - symbol when used in a list to be an emoji.

(after! org)
(font-lock-add-keywords 'org-mode
                          '(("^ *\\([-]\\) "
                             (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "🔹"))))))

Additional documentation

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.