This is my Doom Emacs literate configuration. I am new to Doom, so I don’t know what I want to configure yet. I am trying to add some functions from my old vanilla Emacs configuration. I am still learning how to configure Doom as I was configuring my own vanilla Emacs. I prefer configuration from org-mode so I can easily navigate and better express myself. I also may copy parts of the Doom documentation as reference to myself.
Here are the references that I look frequently.
- API Reference
- Modules Documentation
These are just the beginning of the export files and my personal information, nothing special.
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
;; This is my private configuration file, generated from the README.org file.
(setq user-full-name "Cem Keylan"
user-mail-address "cem@ckyln.com")
;; -*- no-byte-compile: t; -*-
;;; $DOOMDIR/packages.el
Most META keys are used by my window manager configuration, so I don’t want to bind alt-keys to my META key. I also don’t want my local-leader to be a part of the leader itself, because I don’t want to press an extra key for mode-specific bindings.
(setq doom-leader-alt-key "C-SPC"
doom-localleader-key ","
doom-localleader-alt-key "C-,")
There are some features that I don’t exactly appreciate, so I want to redefine or remove them.
I am not a big fan of evil-snipe
as I use s
(substitute) a lot. I’ve removed
the package from my configuration to reclaim s
.
(package! evil-snipe :disable t)
I like the default functionality of pressing TAB on Emacs. I don’t want to jump between items or anything like that. I think Emacs is pretty good at indenting automatically, I can re-align stuff by using space or backspace if am unhappy with it. I don’t want Doom to insert snippets on visual mode, or jump between parentheses on normal mode. Just reclaim default functionality.
As a NOTE, I only care about reclaiming this functionality on prog-mode
.
(setq-hook! prog-mode tab-always-indent t)
(map! :mode prog-mode
:nvmi [tab] #'indent-for-tab-command)
I save my org-mode files on the default directory set by Doom.
(setq org-directory "~/org/")
Below is my main configuration for org-mode, which is set after org is loaded. I have taken most of these from Bernt Hansten’s Guide to Org Mode.
(after! org
(setq-default
org-adapt-indentation nil
org-agenda-span 'week
org-todo-keywords `((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
(sequence "WAITING(w@/!)" "HOLD(h@/!)" "|"
"CANCELLED(c@/!)" "PHONE" "MEETING"))
org-use-fast-todo-selection t
org-refile-targets '((nil :maxlevel . 9) (org-agenda-files :maxlevel . 9))
org-refile-use-outline-path t
org-outline-path-complete-in-steps nil
org-todo-keyword-faces
'(("TODO" :foreground "orange red" :weight bold)
("NEXT" :foreground "cyan" :weight bold)
("DONE" :foreground "spring green" :weight bold)
("WAITING" :foreground "orange" :weight bold)
("HOLD" :foreground "hot pink" :weight bold)
("CANCELLED" :foreground "spring green" :weight bold)
("MEETING" :foreground "spring green" :weight bold)
("PHONE" :foreground "spring green" :weight bold))
org-export-backends '(ascii beamer html latex man md groff
texinfo koma-letter)))
doct
is the “Declarative Org Capture Template”. I use it to have a better
visual way of understanding my capture templates.
(use-package! doct
:after org
:config
(setq org-capture-templates
(doct '(("todo"
:keys "t"
:file "~/org/refile.org"
:clock-in t
:template ("* %{todo-state} %^{Description}"
":PROPERTIES:"
":Created: %U"
":END:" "%?")
:children (("todo"
:keys "t"
:todo-state "TODO")
("next"
:keys "n"
:todo-state "NEXT")))
("note"
:keys "n"
:file "~/org/refile.org"
:clock-in t
:template ("* %? :NOTE:"
"%U"
"%a"))
("email"
:keys "e"
:file "~/org/refile.org"
:clock-in t
:template ("* %? :EMAIL:" "%U" "%a"))
("phone"
:keys "p"
:file "~/org/refile.org"
:clock-in t
:template ("* PHONE %? :PHONE:" "%U" "%a"))
("journal"
:keys "j"
:file "~/org/diary.org"
:datetree t
:template ("* %?" "%U"))
("recipe"
:keys "r"
:file "~/org/recipe.org"
:template ("* %^{Recipe}"
":PROPERTIES:"
":Created: %U"
":END:" "%?"
"** Ingredients"
"** Instructions"))))))
(package! doct)
When I am editing a source block, I want to return back to my org-mode buffer with a single press.
(define-key!
:definer 'minor-mode
:states 'normal
:keymaps 'org-src-mode
"RET" #'org-edit-src-exit)
I don’t use the mu4e configuration from Doom. I have mu4e installed on my system, and I use a custom configuration which is set by my mu4e wizard.
(use-package mu4e
:if (executable-find "mu")
:commands mu4e mu4e-compose-new
:init
(map!
:leader
:desc "Open mu4e" "m u" #'mu4e
:desc "Compose mail" "m c" #'mu4e-compose-new))
(add-to-list 'load-path "~/conf/mu4e/")
(use-package mu4e-config
:if (executable-find "mu")
:after mu4e)
People that know me knows that I am not good with themes and colour design in general. They also know that I slap the dracula theme to anything that I set my eyes on. Doom is not any different for this matter.
(setq doom-theme 'doom-dracula)
I always use relative numbers, but I personally do not like line-numbers on Text modes.
(setq display-line-numbers-type 'relative)
(setq-hook! text-mode display-line-numbers-type nil)
I have some personal packages and configurations that I want to load. I also
have a lisp/
directory that I want to add to my load-path.
(add-load-path! "lisp/")
I prefer using doas instead of sudo
, so I have customized sudo-edit
to use
doas instead.
(use-package! doas-edit
:if (executable-find "doas")
:commands doas-edit-find-file doas-edit
:init
(map!
[remap doom/sudo-find-file] #'doas-edit-find-file
[remap doom/sudo-this-file] #'doas-edit))
(package! doas-edit
:recipe (:host github :repo "cemkeylan/doas-edit"))
I use the redo build system for some of my software. I have made a simple
redo-mode
which adds some syntax highlighting to redo build files (shell
scripts).
(use-package! redo-mode
:mode "\\.do\\'")
(package! redo-mode
:recipe (:host github :repo "cemkeylan/redo-mode"))
I have some simplistic functions as a package maintainer to ease off my work.
(use-package! cpt
:commands cpt-find-file
:init
(map!
:leader
(:prefix ("c p" . "Package manager")
:desc "Find package file" "f" #'cpt-find-file)))
What is the point of a text editor if you are not going to configure it like a maniac? What are you going to do instead? Write code? The AUDACITY!
I care about readability of the source code or the text I write. Even if I am writing markdown, I care more about readability with a pager than HTML output. HTML prettifies the text, a pager does not.
I use text-filling functions in order to stay less than 80 characters where possible. I enforce this on text-modes where there is no excuse for writing more than 80 characters on a file.
(setq-default fill-column 80)
(add-hook! text-mode 'auto-fill-mode)
I sometimes connect to Emacs from my phone (please don’t get mad I want to
continue editing text while going out for a smoke). However, since the screen
of my phone is extremely small, I use visual-line-mode for editing text, and I
basically map j
to gj
and k
to gk
for easier navigation.
;; I don't want to enforce visual-lines on prog-mode
(add-hook! text-mode 'visual-line-mode)
(map! [remap evil-next-line] #'evil-next-visual-line
[remap evil-previous-line] #'evil-previous-visual-line)
I am brain-dead so I constantly try to switch between Emacs keys and Vim keys even after four years of using Vim and a year of using Evil-mode. Let’s accept this behaviour and map some Emacs keys to evil-mode.
(map! :nmi "C-n" #'next-line
:nmi "C-p" #'previous-line
:i "C-a" #'move-beginning-of-line
:i "C-e" #'move-end-of-line)
For some reason, unless you set your preferred coding system, there will be inconsistencies between the terminal and GUI Emacs frames.
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
I had adopted this method while I was using my vanilla Emacs with my literate
configuration. I have a pre-commit
hook so I can commit specific hunks for
each file.
#!/bin/sh -e
# Create the staged version of the README file to a temporary file
git show :README.org > README.tmp.org
trap 'rm -f README.tmp.org' EXIT INT
# Tangle the temporary file and stage the tangled files
org-tangle README.tmp.org
git add config.el packages.el pre-commit.hook
# Revert to the previous state by re-tangling the previous version
org-tangle README.org
I add this hook to the repository by symbolically linking it to the .git
directory.
ln -sf ../../pre-commit.hook .git/hooks/pre-commit
I don’t use coreutils, so my ls
does not have the --dired
option.
(setq dired-use-ls-dired nil)
I automatically tangle this file on save. Saves me from having to remember doing it.
(add-hook! after-save
(defun tangle-doom-conf ()
"Tangle the private doom configuration."
(when (equal buffer-file-name (concat doom-private-dir "README.org"))
(org-babel-tangle))))