dot/.config/doom
2023-08-22 13:06:03 +02:00
..
config.el Added automatic timestamps in Emacs so I can save time/ effort on keybinds. 2023-08-22 13:06:03 +02:00
custom.el Updated a few things in XMonad and Doom Emacs configs 2023-08-11 21:37:18 +02:00
init.el Added automatic timestamps in Emacs so I can save time/ effort on keybinds. 2023-08-22 13:06:03 +02:00
packages.el Added automatic timestamps in Emacs so I can save time/ effort on keybinds. 2023-08-22 13:06:03 +02:00
README.org Added automatic timestamps in Emacs so I can save time/ effort on keybinds. 2023-08-22 13:06:03 +02:00

Phil's Doom Emacs Config

Intro

This is my personal 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.

A lot of these are swiped from DT's Configuring Emacs config files.

config.el

Basic settings, Theme and Display

(setq user-full-name "Phil Bajsicki")

(setq global-auto-revert-mode t)
(setq auth-sources '("~/.authinfo"))

(setq straight-repository-branch "develop")

(after! counsel
  (setq counsel-outline-display-style 'title))


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

(setq doom-font (font-spec :family "Iosevka" :size 12 :weight 'semi-light)
      doom-variable-pitch-font (font-spec :family "Iosevka" :size 13))

(load-theme 'doom-one t)
(doom-themes-neotree-config)
(doom-themes-org-config)

(set-frame-parameter nil 'alpha-background 70)

(add-to-list 'default-frame-alist '(alpha-background . 70))

(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)

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.

(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)

(setq org-superstar-headline-bullets-list
      '("⁖" "◉" "○" "✸" "✿"))

Ensure that hitting M-<return> splits the line it's on. This is useful when I'm typing something long, and then decide to turn a paragraph into a li

(setq org-M-RET-may-split-line '((default . t)))

org-contacts

(setq org-contacts-files '("~/enc/org/people.org"))

Keybinds

(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ch" 'counsel-org-link)
(global-set-key "\C-cne" 'elgantt-open)
(global-set-key "\C-cnn" 'org-capture)

Timestamp keybinds

Inserts timestamps in the proper format. '(16) stands for two universal arguments, keeping the command from prompting for the time. Two keybinds here, which insert an active or inactive timestamp.

(global-set-key "\C-cia"  '(lambda ()(interactive)
                               (org-timestamp '(16))))
(global-set-key "\C-cii"  '(lambda () (interactive)
                               (org-timestamp-inactive '(16))))

Automated timestamps in headings

I need this because hitting the above is tedious, as I keep my journals, expenses and therapy notes in org-roam.

For the files whose paths match the strings in the function, it will advise the org-insert-heading function to insert an inactive timestamp into the new heading.

This turns making new entries from C-<return> C-i i into just C-<return>. Much easier, and I don't have to think about this any more.

(add-hook 'org-insert-heading-hook
          (lambda ()
            (if
                (or
                 (string-match "journal" buffer-file-name)
                 (string-match "money" buffer-file-name)
                 (string-match "therapy" buffer-file-name))
                ((lambda ()
                   (interactive)
                   (org-timestamp-inactive '(16))))
              (setq 'org-insert-heading-hook nil)
            )))

Theming.

(setq org-fontify-todo-headline t)
(setq org-footnote-section nil)
(setq org-table-duration-hour-zero-padding nil)

Todo keywords

(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")))

Capture templates

(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:")))

Org-wild-notifier

This lets me get desktop notifications for TODO items.

(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"))

Org-refile

(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)

(setq find-file-visit-truename t)

org-roam

Keybinds

(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)

org-roam

(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
      '(("n" "default" plain
         "%?"
        :if-new (file+head "%<%Y.%m.%d.%H\:%M>-${slug}.org" "#+title: ${title}\n")
        :unnarrowed t)
        ("j" "journal" plain
         "%?"
        :if-new (file+head "journal/journal-%<%Y.%m.%d.%H\:%M>-${slug}.org" "#+title: ${title}\n")
         :empty-lines 1
         :unnarrowed t)
        ("t" "Therapy" plain
         "
,* Sytuacja
,** Myśli
,** Emocje
,** Zachowania
,** Argumenty potwierdzające myśli
,** Argumenty podważające
,** Myśli alternatywne
,** Emocje alternatywne-
,** Zachowania alternatywne
"
         :if-new (file+head "therapy/therapy-%<%Y.%m.%d.%H\:%M>-${slug}.org" "#+title: ${title}\n")
         :empty-lines 1
         :unnarrowed)))

org-roam-ui

(use-package! websocket
    :after org-roam)

(use-package! org-roam-ui
    :after org-roam ;; or :after org
;;         normally we'd recommend hooking orui after org-roam, but since org-roam does not have
;;         a hookable mode anymore, you're advised to pick something yourself
;;         if you don't care about startup time, use
;;  :hook (after-init . org-roam-ui-mode)
    :config
    (setq org-roam-ui-sync-theme t
          org-roam-ui-follow t
          org-roam-ui-update-on-save t
          org-roam-ui-open-on-start t))

org-elgantt

(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")))))))

org-agenda

Keybinds

(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)

Settings

(setq org-agenda-files (directory-files-recursively "~/enc/org" "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-insert-diary-extract-time t
        org-log-into-drawer t
        org-clock-into-drawer t
        org-agenda-log-mode-items '(closed clock state))


(setq org-agenda-custom-commands
      (quote (("x" "Phil's view" agenda ""
               ((org-agenda-prefix-format " %i %b %-12:c %s %t "))))))

yasnippets

(setq doom-snippets-enable-short-helpers t)

dired-open

(setq dired-open-extensions '(("gif" . "sxiv")
                              ("jpg" . "sxiv")
                              ("png" . "sxiv")
                              ("mkv" . "mpv")
                              ("mp4" . "mpv")))

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.

(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.
 )

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

(doom! :input

completion

:completion
company
ivy

ui

:ui
doom
doom-dashboard
doom-quit
(emoji +unicode)
hl-todo
ligatures
modeline
ophints
(popup +defaults)
treemacs
unicode
vi-tilde-fringe
workspaces

editor

:editor
file-templates
fold
(format +onsave)
snippets
word-wrap

emacs

:emacs
dired
electric
undo
vc

term

:term
vterm

checkers

:checkers
syntax

tools

:tools
(eval +overlay)
lookup
lsp
magit
pdf

lang

:lang
common-lisp
data
emacs-lisp
(haskell +lsp)
latex
(org +pretty)
plantuml
raku
shipsweb
rust
yaml
zig

config

:config
;literate
(default +bindings +smartparens)

closing

)

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:

(package! some-package)

Install a package directly from git repo:

Specify a :recipe. Documentation.

(package! another-package :recipe (:host github
  :repo "username/repo"))

If there is no PACKAGENAME.el file, or it's in a subdirectory, specify :files in the :recipe:

(package! this-package
  :recipe (:host github :repo "username/repo"
           :files ("some-file.el" "src/lisp/*.el")))

Disable packages included with Doom Emacs:

~(package! builtin-package :disable t)~

Override package recipe:

If a property in a :recipe isn't specified, it will use defaults from Doom/MELPA/ELPA/Emacsmirror.

(package! builtin-package :recipe (:nonrecursive t))
(package! builtin-package-2 :recipe (:repo "myfork/package"))

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.

(package! builtin-package :recipe (:branch "develop"))

Install a specific commit:

You can set :pin.

(package! builtin-package :pin "1a2b3c4d5e")

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.

(unpin! pinned-package)
(unpin! pinned-package another-pinned-package)
(unpin! t)
#+end_#+begin_src

Packages:

Core

;; -*- no-byte-compile: t; -*-
;;; $DOOMDIR/packages.el

(unpin! straight)
(package! beacon)
(package! counsel)
(package! deft)

Themes

(package! all-the-icons)
(package! all-the-icons-dired)

(package! doom-themes)

Modes:

(package! battle-haxe)
(package! fish-mode)
(package! typescript-mode)
(package! wc-mode)

Ivy

(package! ivy)
(package! ivy-xref)

dired

(package! dired-open)

Org

(package! org-contacts)
(package! org-bullets)
(package! org-download)
(package! org-cliplink)
(package! org-roam :pin "ca873f7")
(package! org-ql)
(package! org-wild-notifier)
(unpin! org-roam)
(package! org-roam-ui)

Org-depend

Ensure task dependencies are met.

(package! org-depend
 :recipe (
          :host github
                :repo "fgeller/org-mode"
                :files ("contrib/lisp/org-depend.el")))

Elgantt

Pretty Gantt chart for your agenda.

(package! elgantt
  :recipe (:host github :repo "legalnonsense/elgantt"))