2021-11-17 20:01:02 -08:00
#+title : Doomed - Personal Doom Emacs Config
#+author : Tyler Starr
#+email : tyler@tstarr.us
#+keywords : org-mode Emacs Doom config
* References
Configuring Emacs can be an obsession. I have bounced back and forth between my from [[https://github.com/starr-dusT/scratch ][scratch ]] config and doom. In the end I find it hard to give up all the amazing work [[https://github.com/hlissner ][hlissner ]] has put into doom. Doom really simpifies the process of configuring Emacs with lots of pre-made bits and a nice framework for configuration. As much as it annoys me to not completelty control the config of the whole system I must comprimise to maintain my sanity. Find some useful references below:
- [[https://github.com/hlissner/doom-emacs ][Doom Emacs Github ]]
- [[https://github.com/zzamboni/dot-doom ][zzamboni's nice config ]]
* Doom config file overview
Doom Emacs uses three config files:
- =init.el= defines which of the existing Doom [[https://github.com/hlissner/doom-emacs/blob/develop/docs/getting_started.org#modules ][modules ]] are loaded. A Doom module is a bundle of packages, configuration and commands, organized into a unit that can be toggled easily from this file.
- =packages.el= defines which [[https://github.com/hlissner/doom-emacs/blob/develop/docs/getting_started.org#package-management ][packages ]] should be installed, beyond those that are installed and loaded as part of the enabled modules.
- =config.el= contains all [[https://github.com/hlissner/doom-emacs/blob/develop/docs/getting_started.org#configuring-doom ][custom configuration ]] and code.
There are other files that can be loaded, but theses are the main ones. The load order of different files is [[https://github.com/hlissner/doom-emacs/blob/develop/docs/getting_started.org#load-order ][defined depending on the type of session ]] being started.
All the config files are generated from this Org file, to try and make its meaning as clear as possible. All =package!= declarations are written to =packages.el= , all other LISP code is written to =config.el= .
** Config file headers
We start by simply defining the standard headers used by the three files. These headers come from the initial files generated by =doom install= , and contain either some Emacs-LISP relevant indicators like =lexical-binding= , or instructions about the contents of the file.
#+html : <details><summary>init.el</summary>
#+begin_src emacs-lisp :tangle init.el
;;; init.el -*- lexical-binding: t; -* -
;; DO NOT EDIT THIS FILE DIRECTLY
;; This is a file generated from a literate programing source file located at
;; https://github.com/starr-dusT/dotfiles/blob/master/ .doom.d/doomed.org
;; You should make any changes there and regenerate it from Emacs org-mode
;; using org-babel-tangle (C-c C-v t)
;; This file controls what Doom modules are enabled and what order they load
;; in. Remember to run 'doom sync' after modifying it!
;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's
;; documentation. There you'll find a "Module Index" link where you'll find
;; a comprehensive list of Doom's modules and what flags they support.
;; NOTE 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).
#+end_src
#+RESULTS :
#+html : </details>
#+html : <details><summary>packages.el</summary>
#+begin_src emacs-lisp :tangle packages.el
;; -*- no-byte-compile: t; -* -
;;; $DOOMDIR/packages.el
;; DO NOT EDIT THIS FILE DIRECTLY
;; This is a file generated from a literate programing source file located at
;; https://github.com/starr-dusT/dotfiles/blob/master/ .doom.d/doomed.org
;; You should make any changes there and regenerate it from Emacs org-mode
;; using org-babel-tangle (C-c C-v t)
;; 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'.
;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror:
;;(package! some-package)
;; To install a package directly from a remote git repo, you must specify a
;; `:recipe'. You'll find documentation on what `:recipe' accepts here:
;; https://github.com/raxod502/straight.el#the-recipe-format
;;(package! another-package
;; :recipe (:host github :repo "username/repo"))
;; If the package you are trying to install does not contain a PACKAGENAME.el
;; file, or is located in a subdirectory of the repo, you'll need to specify
;; `:files' in the `:recipe':
;;(package! this-package
;; :recipe (:host github :repo "username/repo"
;; :files ("some-file.el" "src/lisp/ *.el")))
;; If you'd like to disable a package included with Doom, you can do so here
;; with the `:disable' property:
;;(package! builtin-package :disable t)
;; 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:
;;(package! builtin-package :recipe (:nonrecursive t))
;;(package! builtin-package-2 :recipe (:repo "myfork/package"))
;; Specify a `:branch' to install a package from a particular branch or tag.
;; This is required for some packages whose default branch isn't 'master' (which
;; our package manager can't deal with; see raxod502/straight.el#279)
;;(package! builtin-package :recipe (:branch "develop"))
;; Use `:pin' to specify a particular commit to install.
;;(package! builtin-package :pin "1a2b3c4d5e")
;; Doom's packages are pinned to a specific commit and updated from release to
;; release. The `unpin!' macro allows you to unpin single packages...
;;(unpin! pinned-package)
;; ...or multiple packages
;;(unpin! pinned-package another-pinned-package)
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
;;(unpin! t)
#+end_src
#+html : </details>
#+html : <details><summary>config.el</summary>
#+begin_src emacs-lisp :tangle config.el
;;; $DOOMDIR/config.el -*- lexical-binding: t; -* -
;; DO NOT EDIT THIS FILE DIRECTLY
;; This is a file generated from a literate programing source file located at
;; https://github.com/starr-dusT/dotfiles/blob/master/ .doom.d/doomed.org
;; You should make any changes there and regenerate it from Emacs org-mode
;; using org-babel-tangle (C-c C-v t)
;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets.
;; (setq user-full-name "John Doe"
;; user-mail-address "john@doe.com")
;; 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))
;; 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. This is the default:
;; (setq doom-theme 'doom-one)
;; 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!
;; (setq org-directory "~/org/ ")
;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
;; (setq display-line-numbers-type t)
;; 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.
#+end_src
#+html : </details>
* Doom modules
#+begin_src emacs-lisp :tangle init.el
(doom! :input
;;chinese
;;japanese
;;layout ; auie,ctsrnm is the superior home row
:completion
company ; the ultimate code completion backend
;;helm ; the *other* search engine for love and life
;;ido ; the other *other* search engine...
ivy ; a search engine for love and life
:ui
;;deft ; notational velocity for Emacs
doom ; what makes DOOM look the way it does
doom-dashboard ; a nifty splash screen for Emacs
doom-quit ; DOOM quit-message prompts when you quit Emacs
;;(emoji +unicode) ; 🙂
;;fill-column ; a `fill-column' indicator
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
;;hydra
;;indent-guides ; highlighted indent columns
;;ligatures ; ligatures and symbols to make your code pretty again
minimap ; show a map of the code on the side
modeline ; snazzy, Atom-inspired modeline, plus API
;;nav-flash ; blink cursor line after big motions
;;neotree ; a project drawer, like NERDTree for vim
ophints ; highlight the region an operation acts on
(popup +defaults) ; tame sudden yet inevitable temporary windows
;;tabs ; a tab bar for Emacs
treemacs ; a project drawer, like neotree but cooler
;;unicode ; extended unicode support for various languages
vc-gutter ; vcs diff in the fringe
vi-tilde-fringe ; fringe tildes to mark beyond EOB
;;window-select ; visually switch windows
workspaces ; tab emulation, persistence & separate workspaces
;;zen ; distraction-free coding or writing
:editor
(evil +everywhere); come to the dark side, we have cookies
file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding
format ; automated prettiness
;;god ; run Emacs commands without modifier keys
;;lispy ; vim for lisp, for people who don't like vim
multiple-cursors ; editing in many places at once
;;objed ; text object editing for the innocent
(parinfer +rust) ; turn lisp into python, sort of
;;rotate-text ; cycle region at point between text candidates
snippets ; my elves. They type so I don't have to
;;word-wrap ; soft wrapping with language-aware indent
:emacs
(dired +ranger) ; making dired pretty [functional]
electric ; smarter, keyword-based electric-indent
;;ibuffer ; interactive buffer management
undo ; persistent, smarter undo for your inevitable mistakes
vc ; version-control and Emacs, sitting in a tree
:term
;;eshell ; the elisp shell that works everywhere
;;shell ; simple shell REPL for Emacs
;;term ; basic terminal emulator for Emacs
;;vterm ; the best terminal emulation in Emacs
:checkers
syntax ; tasing you for every semicolon you forget
;;spell ; tasing you for misspelling mispelling
;;grammar ; tasing grammar mistake every you make
:tools
;;ansible
;;debugger ; FIXME stepping through code, to help you add bugs
;;direnv
;;docker
;;editorconfig ; let someone else argue about tabs vs spaces
;;ein ; tame Jupyter notebooks with emacs
(eval +overlay) ; run code, run (also, repls)
;;gist ; interacting with github gists
lookup ; navigate your code and its documentation
lsp
magit ; a git porcelain for Emacs
;;make ; run make tasks from Emacs
;;pass ; password manager for nerds
;;pdf ; pdf enhancements
;;prodigy ; FIXME managing external services & code builders
;;rgb ; creating color strings
;;taskrunner ; taskrunner for all your projects
;;terraform ; infrastructure as code
;;tmux ; an API for interacting with tmux
;;upload ; map local to remote projects via ssh/ftp
:os
(:if IS-MAC macos) ; improve compatibility with macOS
;;tty ; improve the terminal Emacs experience
:lang
;;agda ; types of types of types of types...
;;cc ; C/C++/Obj-C madness
;;clojure ; java with a lisp
;;common-lisp ; if you've seen one lisp, you've seen them all
;;coq ; proofs-as-programs
;;crystal ; ruby at the speed of c
;;csharp ; unity, .NET, and mono shenanigans
;;data ; config/data formats
;;(dart +flutter) ; paint ui and not much else
;;elixir ; erlang done right
;;elm ; care for a cup of TEA?
emacs-lisp ; drown in parentheses
;;erlang ; an elegant language for a more civilized age
;;ess ; emacs speaks statistics
;;faust ; dsp, but you get to keep your soul
;;fsharp ; ML stands for Microsoft's Language
;;fstar ; (dependent) types and (monadic) effects and Z3
;;gdscript ; the language you waited for
;;(go +lsp) ; the hipster dialect
(haskell +dante) ; a language that's lazier than I am
;;hy ; readability of scheme w/ speed of python
;;idris ; a language you can depend on
;;json ; At least it ain't XML
;;(java +meghanada) ; the poster child for carpal tunnel syndrome
;;javascript ; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script)
;;latex ; writing papers in Emacs has never been so fun
;;lean
;;factor
;;ledger ; an accounting system in Emacs
;;lua ; one-based indices? one-based indices
markdown ; writing docs for people to ignore
;;nim ; python + lisp at the speed of c
;;nix ; I hereby declare "nix geht mehr!"
;;ocaml ; an objective camel
(org ; organize your plain life in plain text
+roam2)
;;php ; perl's insecure younger brother
;;plantuml ; diagrams for confusing people more
;;purescript ; javascript, but functional
(python ; beautiful is better than ugly
+lsp)
;;qt ; the 'cutest' gui framework ever
;;racket ; a DSL for DSLs
;;raku ; the artist formerly known as perl6
;;rest ; Emacs as a REST client
;;rst ; ReST in peace
;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
;;rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
;;scala ; java, but good
;;scheme ; a fully conniving family of lisps
sh ; she sells {ba,z,fi}sh shells on the C xor
;;sml
;;solidity ; do you need a blockchain? No.
;;swift ; who asked for emoji variables?
;;terra ; Earth and Moon in alignment for performance.
;;web ; the tubes
;;yaml ; JSON, but readable
:email
;;(mu4e +gmail)
;;notmuch
;;(wanderlust +gmail)
:app
calendar
;;irc ; how neckbeards socialize
;;(rss +org) ; emacs as an RSS reader
;;twitter ; twitter client https://twitter.com/vnought
:config
;;literate
(default +bindings +smartparens))
#+end_src
#+begin_src emacs-lisp :tangle packages.el
(package! doct)
(package! org-super-agenda :recipe
(:host github
:repo "starr-dusT/org-super-agenda"
:branch "master"))
(package! org-ql :recipe
(:host github
:repo "starr-dusT/org-ql"
:branch "master"))
(package! burly.el :recipe
(:host github
:repo "starr-dusT/burly.el"
:branch "master"))
(package! hindent)
(package! beancount-mode :recipe
(:host github
:repo "beancount/beancount-mode"
:branch "main"))
(package! org-chef)
2021-12-27 14:43:36 -08:00
(package! simple-httpd)
(package! exwm)
2021-11-17 20:01:02 -08:00
#+end_src
* General Configuration
** This System
#+begin_src emacs-lisp :tangle "config.el"
(setq this-system "kestrel")
(setq all-systems '("kestrel" "basilisk" "adjudicator"))
(setq only-kestrel '("kestrel"))
(setq only-basilisk '("basilisk"))
#+end_src
** Identity
#+begin_src emacs-lisp :tangle "config.el"
(setq user-full-name "Tyler Starr"
user-mail-address "starrtyler88@gmail.com")
#+end_src
** User Interface
#+begin_src emacs-lisp :tangle "config.el"
;; 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))
;; 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. This is the default:
(setq doom-theme 'doom-gruvbox)
;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq display-line-numbers-type 'relative)
#+end_src
** Keybindings
Add all my additional keybinds to Doom's standard SPC lead keymapping system.
#+begin_src emacs-lisp :tangle (if (member this-system all-systems) "config.el" "no")
(map! :leader
; Add to the "open" menu in Doom
(:prefix-map ("o" . "open")
(:prefix-map ("o" . "org-ql")
:desc "views" "v" #'org-ql-view
:desc "Weekly Agenda" "w" (cmd! (org-ql-view "Weekly Agenda"))
:desc "Tasks to Refile" "r" (cmd! (org-ql-view "Tasks to Refile"))
:desc "This Weeks Progress" "p" (cmd! (org-ql-view "This Weeks Progress")))))
#+end_src
* Org mode
** Org directories
Define the folder structure for my gtd-esque setup. I don't declaritvely define every file within this folder stucture, but search for .org files within four primary folders: capture, agenda, todo, and note.
#+begin_src emacs-lisp :tangle (if (member this-system all-systems) "config.el" "no")
(setq org-directory "~/documents/org/ ")
(setq org-capture (directory-files-recursively
(concat org-directory "gtd/capture/ ") "\.org$"))
(setq org-agenda (directory-files-recursively
(concat org-directory "gtd/agenda/ ") "\.org$"))
(setq org-todo (directory-files-recursively
(concat org-directory "gtd/todo/ ") "\.org$"))
(setq org-agenda-files (append org-capture org-agenda org-todo))
#+end_src
** Org-Roam
I'm attempting to use [[https://github.com/org-roam/org-roam ][Org-Roam ]] to implement something of the Zettelkasten method. I know... I know it is the flavor of the month, but I've tried to develop my own notetaking methods and workflow and found myself paralyzed by choice. So I'll give this a try!
#+begin_src emacs-lisp :tangle (if (member this-system all-systems) "config.el" "no")
(setq org-roam-directory (concat org-directory "roam"))
(setq org-roam-db-location (concat org-directory "roam/org-roam.db"))
#+end_src
** Get Things Done (GTD)
*** Tasks
Define the org todo keywords we'll use.
#+begin_src emacs-lisp :tangle (if (member this-system all-systems) "config.el" "no")
(after! org
(setq org-todo-keywords
'((sequence "TODO(t)" "NEXT(n)" "CHASE(c)" "WIP(p)" "WAIT(w@/!)"
"GAVE(g@/!)" "|" "KILL(k@/ !)" "DONE(d)")))
; TODO add (1)...(10) numbers for task ordering (replacing "next")
(setq org-todo-keyword-faces
(quote (("TODO" :foreground "red" :weight bold)
("CHASE" :foreground "red" :weight bold)
("WIP" :foreground "blue" :weight bold)
("NEXT" :foreground "orange" :weight bold)
("GAVE" :foreground "orange" :weight bold)
("WAIT" :foreground "orange" :weight bold)
("KILL" :foreground "forest green" :weight bold)
("DONE" :foreground "forest green" :weight bold))))
#+end_src
*** Tags
Define the A tier tags.
#+begin_src emacs-lisp :tangle (if (member this-system all-systems) "config.el" "no")
(setq org-use-tag-inheritance t)
(setq org-tags-exclude-from-inheritance '("prj" "prg" "subprj"))
(setq org-tag-alist
'((:startgroup)
; Put mutually exclusive tags here
(:endgroup)
("@home" . ?h)
("@work" . ?w)
("question" . ?q)
("exclude" . ?e)
("prj" . ?p)
("subprj" . ?s)
("prg" . ?P)
("habit" . ?h)
("me" . ?m)
("Aaron" . ?a)
("Landon" . ?l)
("Valerie" . ?v)
("David" . ?d)))
#+end_src
*** Capture
**** Capture File Paths
Define the different files that are used for capture. Currently, I use inbox.org for TODO esque items and note.org for notes.
#+begin_src emacs-lisp :tangle (if (member this-system all-systems) "config.el" "no")
(setq org-capture-todo (concat org-directory "gtd/capture/inbox.org"))
#+end_src
**** Capture Templates
Setup org-capture templates for nice capturing.
Allowable tags: @work, @home, note, question, habit
#+begin_src emacs-lisp :tangle (if (member this-system all-systems) "config.el" "no")
(setq org-capture-templates
(doct '(("todo" :keys "t"
:file org-capture-todo
:template ("* TODO %?" "%U"))
("question" :keys "q"
:file org-capture-todo
:template ("* TODO Find out %? :question:"
"%U"))
("habit" :keys "h"
:file org-capture-todo
:template ("* NEXT %? :habit:exclude:" "%U"
"SCHEDULED: %(format-time-string
\"%<<%Y-%m-%d %a .+1d/3d >>\")"
":PROPERTIES:" ":STYLE: habit"
":REPEAT_TO_STATE: NEXT" ":END:"))
("meeting" :keys "m"
:file org-capture-todo
:template ("* NEXT %? :meeting:exclude:"
"%U")))))
#+end_src
*** Refile
Set various refile settings. Mostly stolen from the great http://doc.norang.ca/org-mode.html.
#+begin_src emacs-lisp :tangle (if (member this-system all-systems) "config.el" "no")
(setq org-refile-targets (quote ((nil :maxlevel . 3)
(org-agenda-files :maxlevel . 3))))
(advice-add 'org-refile :after 'org-save-all-org-buffers)
#+end_src
*** Views
**** Agenda
Currenlty I prefer to used vanilla Org-Agenda to view currently scheduled agenda items without any fancy sorting or anything like that.
#+begin_src emacs-lisp :tangle (if (member this-system all-systems) "config.el" "no")
(setq org-agenda-start-day "0d")
(setq org-agenda-show-future-repeats 'next)
(setq org-agenda-custom-commands
'(("w" "Super awesome work agenda"
((agenda "" ((org-agenda-overriding-header "")
(org-super-agenda-groups
'((:name "SCHEDULED"
:time-grid t
:date today
:todo "TODAY"
:scheduled today
:not (:todo "WIP"))
(:name "DUE"
:deadline today)
(:name "OVERDUE"
:deadline past)
(:name "DUE SOON"
:deadline future)
(:name "PAST SCHEDULED"
:scheduled past
:not (:todo "WIP"))
(:name "SCHEDULED SOON"
:scheduled future
:not (:todo "WIP"))
(:discard (:anything t))))))
(alltodo "" ((org-agenda-overriding-header "")
(org-super-agenda-groups
'((:name "TASK TO REFILE"
:file-path "gtd/capture")
(:name "IN PROGRESS"
:todo "WIP")
(:name "IMPORTANT"
:priority "A")
(:name "QUESTION"
:tag "question")
(:name "STANDALONE TASKS"
:and (:todo "TODO"
:not (:tag "exclude")))
(:name "WAITING"
:and (:todo "WAIT"
:not (:tag "exclude")))
(:name "DELEGATED"
:and (:todo "GAVE"
:not (:tag "exclude")))
(:discard (:anything t))))))))))
#+end_src
**** Org-ql
Following config items will utilizes the awesome [[https://github.com/alphapapa/org-ql#function-org-ql-block ][org-ql ]] and [[https://github.com/alphapapa/org-super-agenda ][super-org-agenda ]] to setup custom views with fancy sorting and insights. More details to follow!
***** Weekly Agenda
#+begin_src emacs-lisp :tangle (if (member this-system all-systems) "config.el" "no")
(setq org-ql-weekly-agenda
(cons "Weekly Agenda"
(lambda ()
"Open agenda for week."
(interactive)
(org-agenda nil "t"))))
#+end_src
***** Tasks to Refile
#+begin_src emacs-lisp :tangle (if (member this-system all-systems) "config.el" "no")
(setq org-ql-refile-tasks
(cons "Tasks to Refile"
(lambda ()
"Find tasks to refile."
(interactive)
(org-ql-search (list org-capture-todo)
'(or (not (done))
(done))
:title "Tasks to Refile"
:sort '(date priority todo)
:super-groups '((:name "Todos"
:not (:tag "note")))))))
#+end_src
***** This Weeks Progress
#+begin_src emacs-lisp :tangle (if (member this-system all-systems) "config.el" "no")
(setq org-ql-weeks-progress
(cons "This Weeks Progress"
(lambda ()
"launch an agenda-like view at the specified date."
(interactive)
(let* ((ts (ts-now))
(beg-of-week (->> ts
(ts-adjust 'day (- (ts-dow (ts-now))))
(ts-apply :hour 0 :minute 0 :second 0)))
(end-of-week (->> ts
(ts-adjust 'day (- 6 (ts-dow (ts-now))))
(ts-apply :hour 23 :minute 59 :second 59))))
(org-ql-search (org-agenda-files)
'(ts-active :from beg-of-week :to end-of-week)
:title "Week Overview"
:sort '(date priority todo)
:super-groups '((:name "Late"
:scheduled past
:deadline past)
(:name "Today"
:time-grid t
:scheduled today
:deadline today)
(:name "Coming Up"
:scheduled future
:deadline future)))))))
#+end_src
***** Project View
#+begin_src emacs-lisp :tangle (if (member this-system all-systems) "config.el" "no")
(defun open-org-ql-project (program)
(org-ql-search (list program)
'(and (todo)
(not (children)))
:super-groups '((:auto-outline-path t))))
(setq org-ql-project-view
(cons "Project View"
(lambda ()
"launch a project view for a given program."
(interactive)
(ivy-read "Project: "
(org-agenda-files)
:require-match t
:action #'open-org-ql-project))))
#+end_src
***** Final
#+begin_src emacs-lisp :tangle (if (member this-system all-systems) "config.el" "no")
(setq org-super-agenda-header-map (make-sparse-keymap))
(setq org-ql-views
(list org-ql-weekly-agenda
org-ql-refile-tasks
org-ql-weeks-progress
org-ql-project-view))
(after! org-agenda
(org-super-agenda-mode))
#+end_src
** Misc small settings
#+begin_src emacs-lisp :tangle (if (member this-system all-systems) "config.el" "no")
(setq org-startup-folded t)
(setq org-src-preserve-indentation t)) ; Close the after! org expression
#+end_src
* Devel
** Haskell
#+begin_src emacs-lisp :tangle (if (member this-system all-systems) "config.el" "no")
(add-hook 'haskell-mode-hook #'hindent-mode)
(setq lsp-enable-on-type-formatting nil)
#+end_src
** Beancount
#+begin_src emacs-lisp :tangle (if (member this-system all-systems) "config.el" "no")
(defun ts/next-fixme()
"Move cursor and delete next FIXME in beancount file."
(interactive)
(re-search-forward "FIXME" nil t)
(delete-char -5))
(defun ts/next-fixme-replace()
"Move cursor, delete next FIXME, and insert account in beancount file."
(interactive)
(ts/next-fixme)
(call-interactively 'beancount-insert-account)
(call-interactively 'beancount-align-numbers))
(beancount-mode)
(define-key beancount-mode-map (kbd "C-c F") #'ts/next-fixme)
(define-key beancount-mode-map (kbd "C-c f") #'ts/next-fixme-replace)
#+end_src
2021-12-27 14:43:36 -08:00
* Desktop
#+begin_src emacs-lisp :tangle (if (member this-system all-systems) "config.el" "no")
(setq ts/exwm-enabled t)
(defun ts/update-screen-layout ()
(interactive)
(let ((layout-script "~/.doom.d/scripts/update-screens"))
(message "Running screen layout script: %s" layout-script)
(start-process-shell-command "xrandr" nil layout-script)))
(defun ts/set-wallpaper ()
(interactive)
(start-process-shell-command
"feh" nil "feh --bg-scale /home/tstarr/media/pictures/wallpapers/random_wallpapers/halfdome-2560x1440.jpg"))
(defun ts/configure-desktop ()
(interactive)
;;(dw/run-xmodmap)
(ts/update-screen-layout)
(ts/set-wallpaper))
;;(run-at-time "2 sec" nil (lambda () (dw/update-wallpapers))))
(when ts/exwm-enabled
(set-frame-parameter (selected-frame) 'alpha '(95 . 95))
(add-to-list 'default-frame-alist '(alpha . (95 . 95))))
(defun ts/on-exwm-init ()
(ts/configure-desktop))
(when ts/exwm-enabled
;; Configure the desktop for first load
(add-hook 'exwm-init-hook #'ts/on-exwm-init))
;; Enable exwm-randr before exwm-init gets called
(require 'exwm-randr)
(exwm-randr-enable)
;; Set the default number of workspaces
(setq exwm-workspace-number 5)
(defun efs/exwm-update-class ()
(exwm-workspace-rename-buffer exwm-class-name))
;; When window "class" updates, use it to set the buffer name
(add-hook 'exwm-update-class-hook #'efs/exwm-update-class)
;; These keys should always pass through to Emacs
(setq exwm-input-prefix-keys
'(?\C-x
?\C-u
?\C-h
?\M-x
?\M-`
?\M-&
?\M-:
?\C-w
?\C-\M-j ;; Buffer list
?\C-\ )) ;; Ctrl+Space
;; Ctrl+Q will enable the next key to be sent directly
(define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
;; Set up global key bindings. These always work, no matter the input state!
;; Keep in mind that changing this list after EXWM initializes has no effect.
(setq exwm-input-global-keys
`(
;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard)
([?\s-r] . exwm-reset)
;; Move between windows
([s-left] . windmove-left)
([s-right] . windmove-right)
([s-up] . windmove-up)
([s-down] . windmove-down)
;; Launch applications via shell command
([?\s-o] . (lambda (command)
(interactive (list (read-shell-command "$ ")))
(start-process-shell-command command nil command)))
;; Switch workspace
([?\s-w] . exwm-workspace-switch)
;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9)
,@(mapcar (lambda (i)
`(,(kbd (format "s-%d" i)) .
(lambda ()
(interactive)
(exwm-workspace-switch-create ,i))))
(number-sequence 0 9))))
(setq exwm-randr-workspace-monitor-plist '(2 "HDMI-0" 4 "HDMI-0"))
(exwm-enable)
#+end_src