Literate config for Doom Emacs.

This commit is contained in:
Phil Bajsicki 2023-08-12 17:25:26 +02:00
parent b9cd319de2
commit 431d49896e

456
.config/doom/README.org Normal file
View file

@ -0,0 +1,456 @@
#+title: Phil's Doom Emacs Config
* Intro
This is my personal [[https://github.com/doomemacs/doomemacs][Doom Emacs]] config. The important bit is that I have some additional keybinds. This file is a catch-all for all the files in $DOOMDIR - you can use ~org-babel-tangle~ to tangle them into their respective files.
Some of the comments are from the default config.el file that ships with Doom Emacs.
You can extract all the source/ config files from here by running Emacs and hitting ~C-c C-v t~.
* config.el
** Basic settings, Theme and Display
#+begin_src emacs-lisp :tangle config.el
(setq user-full-name "Phil Bajsicki")
(setq global-auto-revert-mode t)
(setq auth-sources '("~/.authinfo"))
(after! counsel
(setq counsel-outline-display-style 'title))
(setq doom-font (font-spec :family "Iosevka" :size 12 :weight 'semi-light)
doom-variable-pitch-font (font-spec :family "Iosevka" :size 13))
(setq doom-theme 'doom-one)
(setq display-line-numbers-type 'relative)
(setq next-screen-context-lines 4)
(after! persp-mode
(setq persp-emacsclient-init-frame-behaviour-override "main"))
(setq doom-modeline-persp-name t)
#+end_src
** 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!
Make .org file automatically open in org-mode.
#+begin_src emacs-lisp :tangle config.el
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(setq org-directory "~/enc/org/")
(setq org-contacts-files
(file-expand-wildcards "~/enc/org/*.org"))
(setq-default org-enforce-todo-dependencies t)
#+end_src
*** Org-contacts
*** Keybinds
#+begin_src emacs-lisp :tangle config.el
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ch" 'counsel-org-link)
(global-set-key "\C-cne" 'elgantt-open)
#+end_src
*** Theming.
#+begin_src emacs-lisp config.el
(setq org-superstar-special-todo-items t)
(setq org-fontify-todo-headline t)
(setq org-footnote-section nil)
(setq org-table-duration-hour-zero-padding nil)
#+end_src
*** Todo keywords
#+begin_src emacs-lisp :tangle config.el
(setq org-todo-keywords
'((sequence
"INBOX(i)"
"TASK(t)" ; A task that needs doing & is ready to do
"PROJ(p)" ; A project, which usually contains other tasks
"LOOP(r)" ; A recurring task
"WAIT(w)" ; Something external is holding up this task
"HOLD(h)" ; This task is paused/on hold because of me
"|"
"DONE(d)" ; Task successfully completed
"KILL(k)") ; Task was cancelled, aborted or is no longer applicable
(sequence
"DECIDE()" ; for making decisions
"|"
"OKAY(o)" ; okay as-is
"YES(y)" ; take action
"NO(n)")) ; don't take action
org-todo-keyword-faces
'(("[-]" . +org-todo-active)
("STRT" . +org-todo-active)
("[?]" . +org-todo-onhold)
("WAIT" . +org-todo-onhold)
("HOLD" . +org-todo-onhold)
("PROJ" . +org-todo-project)
("NO" . +org-todo-cancel)
("KILL" . +org-todo-cancel)))
(setq hl-todo-keyword-faces
'(("HOLD" . "#d0bf8f")
("TODO" . "#cc9393")
("NEXT" . "#dca3a3")
("THEM" . "#dc8cc3")
("PROG" . "#7cb8bb")
("OKAY" . "#7cb8bb")
("DONT" . "#5f7f5f")
("FAIL" . "#8c5353")
("DONE" . "#afd8af")
("NOTE" . "#d0bf8f")
("KLUDGE" . "#d0bf8f")
("HACK" . "#d0bf8f")
("TEMP" . "#d0bf8f")
("FIXME" . "#cc9393")
("XXXX*" . "#cc9393")))
#+end_src
*** Capture templates
#+begin_src emacs-lisp :tangle config.el
(setq org-capture-templates '(("t" "inbox" entry (file+headline "~/enc/org/phil.org" "Inbox") "* TODO %i%?")
("i" "idea" entry (file+headline "~/enc/org/phil.org" "Ideas") "* %?")
("d" "reminder" entry (file+headline "~/enc/org/phil.org" "Reminders") "* %i%? \n %U")
("p" "person" entry (file+headline "~/enc/org/people.org" "People")
"* %(org-contacts-template-name)
:PROPERTIES:
:EMAIL: %(org-contacts-template-email)
:PHONE: %(org-contacts-template-phone)
:ALIAS:
:NICKNAME:
:IGNORE:
:ICON:
:NOTE:
:ADDRESS:
:BIRTHDAY:
:END:")))
#+end_src
*** Org-wild-notifier
This lets me get desktop notifications for TODO items.
#+begin_src emacs-lisp :tangle config.el
(org-wild-notifier-mode)
(setq org-wild-notifier-alert-time '(10))
(setq org-wild-notifier-notification-title "Emacs org-mode agenda")
(setq org-wild-notifier-keyword-whitelist '("TODO"))
#+end_src
*** Org-refile
#+begin_src emacs-lisp :tangle config.el
(setq org-refile-targets '((nil :maxlevel . 9)
(org-agenda-files :maxlevel . 9)))
(setq org-outline-path-complete-in-steps nil)
(setq org-refile-use-outline-path t)
#+end_src
(setq find-file-visit-truename t)
** Org-roam
*** Keybinds
#+begin_src emacs-lisp :tangle config.el
(define-prefix-command 'org-roam-map)
(global-set-key "\C-r" 'org-roam-map)
(define-key org-roam-map "o" 'org-roam-buffer-toggle)
(define-key org-roam-map "f" 'org-roam-node-find)
(define-key org-roam-map "i" 'org-roam-node-insert)
(define-key org-roam-map "n" 'org-roam-capture)
#+end_src
*** Org-roam
#+begin_src emacs-lisp :tangle config.el
(setq org-roam-v2-ack t)
(setq org-roam-completion-everywhere t)
(setq org-roam-directory
(file-truename "~/enc/org/roam"))
(org-roam-db-autosync-mode)
(org-roam-db-autosync-enable)
(setq org-roam-capture-templates
'(("r" "default" plain
"%?"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
:unnarrowed t)))
#+end_src
** Org-elgantt
#+begin_src emacs-lisp :tangle config.el
(add-to-list 'load-path "~/.emacs.d/.local/straight/repos/elgantt/")
(setq elgantt-header-type 'outline
elgantt-draw-overarching-headers t
elgantt-insert-header-even-if-no-timestamp nil
elgantt-scroll-to-current-month-at-startup t)
(setq elgantt-user-set-color-priority-counter 0)
(setq elgantt-custom-header-line
'((:left ((:prop date-at-point
:padding 25)
(:prop todo
:padding 30)))
(:center ((:prop headline)))
(:right ((:prop hashtag
:padding 40
:text-props (face (:background "red")))))))
#+end_src
** Org-agenda
*** Keybinds
#+begin_src emacs-lisp :tangle config.el
(global-set-key "\C-ca" 'org-agenda)
(define-prefix-command 'org-agenda-map)
(global-set-key "\C-a" 'org-agenda-map)
(define-key org-agenda-map "n" 'org-agenda-capture)
(define-key org-agenda-map "a" 'org-agenda)
#+end_src
*** Settings
#+begin_src emacs-lisp :tangle config.el
(setq org-agenda-files '("~/enc/org/org-agenda-files.org"))
(setq org-agenda-start-day nil
org-agenda-span '14
org-agenda-dim-blocked-tasks 'invisible
org-agenda-sorting-strategy
'((agenda habit-down time-up priority-down category-keep)
(todo priority-down category-keep)
(search category-keep))
org-deadline-warning-days 3
org-agenda-include-diary "~/enc/org/phil-journal.org"
org-agenda-insert-diary-extract-time t
org-log-into-drawer t
org-clock-into-drawer t
org-agenda-log-mode-items '(closed clock state))
#+end_src
** Yasnippets
#+begin_src emacs-lisp :tangle config.el
(setq doom-snippets-enable-short-helpers t)
#+end_src
* custom.el
Custom variables. Note that this file is generally set up automatically by Emacs, so I'm not exporting this block. I'm keeping the default warning commants in just for completion here.
#+begin_src
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(org-safe-remote-resources
'("\\`https://bajsicki\\.com/org-html-themes/org/theme-readtheorg\\.setup\\'")))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
#+end_src
* init.el
This is the state as of <2023-08-12 Sat>. I'm sure Doom Emacs will expand/ change/ add/ remove things over time, but this is what I use right now.
** input
#+begin_src emacs-lisp :tangle init.el
(doom! :input
#+end_src
** completion
#+begin_src emacs-lisp :tangle init.el
:completion
company
ivy
#+end_src
** ui
#+begin_src emacs-lisp :tangle init.el
:ui
doom
doom-dashboard
doom-quit
(emoji +unicode)
hl-todo
ligatures
modeline
ophints
(popup +defaults)
treemacs
unicode
vi-tilde-fringe
workspaces
#+end_src
** editor
#+begin_src emacs-lisp :tangle init.el
:editor
file-templates
fold
(format +onsave)
snippets
word-wrap
#+end_src
** emacs
#+begin_src emacs-lisp :tangle init.el
:emacs
dired
electric
undo
vc
#+end_src
** term
#+begin_src emacs-lisp :tangle init.el
:term
vterm
#+end_src
** checkers
#+begin_src emacs-lisp :tangle init.el
:checkers
syntax
#+end_src
** tools
#+begin_src emacs-lisp :tangle init.el
:tools
(eval +overlay)
lookup
lsp
magit
pdf
#+end_src
** lang
#+begin_src emacs-lisp :tangle init.el
:lang
common-lisp
data
emacs-lisp
(haskell +lsp)
latex
org
plantuml
raku
shipsweb
rust
yaml
zig
#+end_src
** config
#+begin_src emacs-lisp :tangle init.el
:config
;literate
(default +bindings +smartparens)
#+end_src
** closing
#+begin_src emacs-lisp :tangle init.el
)
#+end_src
* packages.el
** Info from the included (default) comments:
To install a package with Doom you must declare them here and run 'doom sync' on the command line, then restart Emacs for the changes to take effect -- or use 'M-x doom/reload'.
*** Install from MELPA, ELPA or emacsmirror:
#+begin_src emacs-lisp :tangle no
(package! some-package)
#+end_src
*** Install a package directly from git repo:
Specify a ~:recipe~. [[https://github.com/raxod502/straight.el#the-recipe-format][Documentation.]]
#+begin_src emacs-lisp :tangle no
(package! another-package :recipe (:host github
:repo "username/repo"))
#+end_src
If there is no PACKAGENAME.el file, or it's in a subdirectory, specify ~:files~ in the ~:recipe~:
#+begin_src emacs-lisp :tangle no
(package! this-package
:recipe (:host github :repo "username/repo"
:files ("some-file.el" "src/lisp/*.el")))
#+end_src
*** Disable packages included with Doom Emacs:
#+begin_src emacs-lisp :tangle no
~(package! builtin-package :disable t)~
#+end_src
*** Override package recipe:
If a property in a ~:recipe~ isn't specified, it will use defaults from Doom/MELPA/ELPA/Emacsmirror.
#+begin_src emacs-lisp :tangle no
(package! builtin-package :recipe (:nonrecursive t))
(package! builtin-package-2 :recipe (:repo "myfork/package"))
#+end_src
You can override the recipe of a built in package without having to
specify all the properties for `:recipe'. These will inherit the rest
of its recipe from Doom or MELPA/ELPA/Emacsmirror:
*** Install package from specific branch:
You can set the ~:branch~ property. This is required for some packages.
#+begin_src emacs-lisp :tangle no
(package! builtin-package :recipe (:branch "develop"))
#+end_src
*** Install a specific commit:
You can set ~:pin~.
#+begin_src emacs-lisp :tangle no
(package! builtin-package :pin "1a2b3c4d5e")
#+end_src
*** Unpin a commit:
Doom's packages are pinned to a specific commit and updated from release to
release. You can ~unpin!~ them. Note ~(unpin! t)~ unpins all the packages and can break your Emacs.
#+begin_src emacs-lisp :tangle no
(unpin! pinned-package)
(unpin! pinned-package another-pinned-package)
(unpin! t)
#+end_#+begin_src
#+end_src
** Packages:
*** Core
#+begin_src emacs-lisp :tangle packages.el
;; -*- no-byte-compile: t; -*-
;;; $DOOMDIR/packages.el
(unpin! straight)
(package! beacon)
(package! counsel)
(package! deft)
#+end_src
*** Modes:
#+begin_src emacs-lisp :tangle packages.el
(package! battle-haxe)
(package! fish-mode)
(package! typescript-mode)
(package! wc-mode)
#+end_src
*** Ivy
#+begin_src emacs-lisp :tangle packages.el
(package! ivy)
(package! ivy-xref)
#+end_src
*** Org
#+begin_src emacs-lisp :tangle packages.el
(package! org-contacts)
(package! org-download)
(package! org-cliplink)
(package! org-roam)
(package! org-ql)
(package! org-wild-notifier)
#+end_src
*** Org-depend
Ensure task dependencies are met.
#+begin_src emacs-lisp :tangle packages.el
(package! org-depend
:recipe (
:host github
:repo "fgeller/org-mode"
:files ("contrib/lisp/org-depend.el")))
#+end_src
*** Elgantt
Pretty Gantt chart for your agenda.
#+begin_src emacs-lisp :tangle packages.el
(package! elgantt
:recipe (:host github :repo "legalnonsense/elgantt"))
#+end_src