diff --git a/dotfiles/doom/config.org b/dotfiles/doom/config.org index 2a62664..ff2a084 100755 --- a/dotfiles/doom/config.org +++ b/dotfiles/doom/config.org @@ -16,6 +16,43 @@ friends to use. + [[https://github.com/psamim/dotfiles][Agenda/org prettify stuff]] + [[https://gitlab.com/dwt1/dotfiles/-/tree/master/.config/doom][DT's original repo]] +** Variables +Below are some variables, which effect a lot of paths on the configuration, +putting these variables on top, will make it easier to make this file modular. + +#+begin_src emacs-lisp :tangle ./config.el +(defvar my/org-device (or (getenv "ORG_DEVICE") "default")) +(defvar my/org-base-dir + (cond + ((string= my/org-device "galaxy") "~/notes") + ((string= my/org-device "workstation") "~/Documents/Notes/") + (t "~/Documents/Notes/"))) +(defvar my/doom-config-dir + (cond + ((string= my/org-device "galaxy") "~/.config/doom/") + ((string= my/org-device "workstation") "~/Development/NixOS/dotfiles/doom/") + (t "~/.config/doom/"))) +(defvar my/doom-data-dir + (cond + ((string= my/org-device "galaxy") "~/.config/doom") + ((string= my/org-device "workstation") "~/.local/share/doom/") + (t "~/.config/doom/"))) +(defvar my/hugo-posts-dir + (cond + ((string= my/org-device "galaxy") "~/portfolio/content-org/") + ((string= my/org-device "workstation") "~/Development/Websites/portfolio/content-org/") + (t "~/portfolio/content-org/"))) + +(defvar my/org-agenda-cache-file (expand-file-name ".cache" my/org-base-dir) + "Path to the org-agenda cache file.") +(defvar my/org-always-included-agenda-files + (list + (expand-file-name "20220823172331-chores.org" my/org-base-dir)) + "Org files to always include in the agenda, even if no TODOs are found.") +(defvar my/doom-template-dir (expand-file-name "templates/" my/doom-data-dir) + "Directory for org-roam capture templates.") +#+end_src + * BIBLE Allows me to insert bible quotes into my org notes. =NOTE= I'm not religious just for worldbuilding purposes lol. @@ -49,7 +86,7 @@ bookmarks is to record where you were reading in bookmarked files. | bookmark-save | /Save current bookmark to bookmark file/ | SPC b w | #+BEGIN_src emacs-lisp :tangle ./config.el -(setq bookmark-default-file "~/.local/share/doom/bookmarks") +(setq bookmark-default-file (expand-file-name "bookmarks" my/doom-data-dir)) (map! :leader (:prefix ("b". "buffer") @@ -273,37 +310,6 @@ counsel-load-theme with 'SPC h t'. 'doom-opera-light)) #+end_src -* EMMS -One of the media players available for Emacs is emms, which stands for Emacs -Multimedia System. By default, Doom Emacs does not use 'SPC m p d',' so the format -I use for these bindings is 'SPC a' plus 'key'. - -| COMMAND | DESCRIPTION | KEYBINDING | -|-----------------------+---------------------------------+------------| -| emms-playlist-mode-go | /Switch to the playlist buffer/ | SPC a a | -| emms-pause | /Pause the track/ | SPC a x | -| emms-stop | /Stop the track/ | SPC a s | -| emms-previous | /Play previous track in playlist/ | SPC a p | -| emms-next | /Play next track in playlist/ | SPC a n | - -#+begin_src emacs-lisp :tangle ./config.el -;; (emms-all) -;; (emms-default-players) -;; (emms-mode-line 1) -;; (emms-playing-time 1) -;; (setq emms-source-file-default-directory "~/Music/" -;; emms-playlist-buffer-name "*Music*" -;; emms-info-asynchronously t -;; emms-source-file-directory-tree-function 'emms-source-file-directory-tree-find) -;; (map! :leader -;; (:prefix ("m p d". "EMMS audio player") -;; :desc "Go to emms playlist" "a" #'emms-playlist-mode-go -;; :desc "Emms pause track" "x" #'emms-pause -;; :desc "Emms stop track" "s" #'emms-stop -;; :desc "Emms play previous track" "p" #'emms-previous -;; :desc "Emms play next track" "n" #'emms-next)) -#+end_src - * EVALUATE ELISP EXPRESSIONS Changing some keybindings from their defaults to better fit with Doom Emacs, and to avoid conflicts with my window managers which sometimes use the control key @@ -486,7 +492,7 @@ Capture template for new hugo posts. ;; It is assumed that below file is present in `org-directory' ;; and that it has a "Blog Ideas" heading. It can even be a ;; symlink pointing to the actual location of all-posts.org! - (file+olp "/home/jawz/Development/Websites/portfolio/content-org/posts.org" "blog") + (file+olp (expand-file-name "posts.org" my/hugo-posts-dir) "blog") (function org-hugo-new-subtree-post-capture-template)) )) #+end_src @@ -611,26 +617,31 @@ Emacs or 'SPC f f' in Doom Emacs. These keybindings use find-file non-interactively since we specify exactly what file to open. The format I use for these bindings is 'SPC =' plus 'key' since Doom Emacs does not use 'SPC ='. -| PATH TO FILE | DESCRIPTION | KEYBINDING | -|------------------------------+-----------------------+------------| -| ~/Documents/Notes/Agenda.org | /Edit agenda file/ | SPC = a | -| ~/.config/doom/config.org | /Edit doom config.org/ | SPC = c | -| ~/.config/doom/init.el | /Edit doom init.el/ | SPC = i | -| ~/.config/doom/packages.el | /Edit doom packages.el/ | SPC = p | +| PATH TO FILE | DESCRIPTION | KEYBINDING | +|---------------------+-----------------------+------------| +| ../Agenda.org | /Edit agenda file/ | SPC = a | +| ../doom/config.org | /Edit doom config.org/ | SPC = c | +| ../doom/init.el | /Edit doom init.el/ | SPC = i | +| ../doom/packages.el | /Edit doom packages.el/ | SPC = p | #+begin_src emacs-lisp :tangle ./config.el (map! :leader (:prefix ("=" . "open file") - :desc "Edit agenda file" "a" #'(lambda () (interactive) - (find-file - "~/Documents/Notes/20220819130052-agenda.org")) - :desc "Edit doom config.org" "c" #'(lambda () (interactive) - (find-file - "~/Development/NixOS/dotfiles/doom/config.org")) - :desc "Edit doom init.el" "i" #'(lambda () (interactive) - (find-file "~/Development/NixOS/dotfiles/doom/init.el")) - :desc "Edit doom packages.el" "p" #'(lambda () (interactive) - (find-file "~/Development/NixOS/dotfiles/doom/packages.el")))) + :desc "Edit agenda file" "a" + #'(lambda () (interactive) + (find-file (expand-file-name "20220819130052-agenda.org" my/org-base-dir))) + + :desc "Edit doom config.org" "c" + #'(lambda () (interactive) + (find-file (expand-file-name "config.org" my/doom-config-dir))) + + :desc "Edit doom init.el" "i" + #'(lambda () (interactive) + (find-file (expand-file-name "init.el" my/doom-config-dir))) + + :desc "Edit doom packages.el" "p" + #'(lambda () (interactive) + (find-file (expand-file-name "packages.el" my/doom-config-dir))))) #+end_src * LSP @@ -662,9 +673,9 @@ Doom Emacs. #+begin_src emacs-lisp :tangle ./config.el (after! org - (setq org-directory "~/Documents/Notes/" - org-id-locations-file "~/Documents/Notes/.orgids" - org-attach-id-dir "~/Documents/Notes/images" + (setq org-directory my/org-base-dir + org-id-locations-file (expand-file-name ".orgids" my/org-base-dir) + org-attach-id-dir (expand-file-name "images" my/org-base-dir) org-ellipsis " ▼ " org-superstar-headline-bullets-list '("◉" "●" "○" "◆" "●" "○" "◆") org-superstar-item-bullet-alist '((?+ . ?+) (?- . ?-)) @@ -677,10 +688,10 @@ Doom Emacs. "PROJ(p)" ; A project, which usually contains other tasks "ART(a)" ; Similar to PROJ but focused on drawing "IDEA(i)" ; Misc tasks, usually to elaborate on writing later - "HOLD(h)" ; This task is paused/on hold because I'm a lazy fuck + "HOLD(h)" ; This task on hold because I'm a lazy fuck "|" "DONE(d)" ; Task succesfully completed - "CANCELED(c)") ; Task was cancelled + "CANCELED(c)") ; Cancelled task (sequence "[ ](T)" ; A task that needs doing "[-](S)" ; A task in progress @@ -699,22 +710,15 @@ Doom Emacs. #+end_src ** Org Agenda Cache -Reads the `.cache` file in `~/Documents/Notes/`, which contains only Org files +Reads the `.cache` file in `my/org-base-dir`, which contains only Org files with active TODOs, and sets `org-agenda-files` accordingly. Falls back to an empty list if the cache doesn’t exist. #+begin_src emacs-lisp :tangle ./config.el -(defvar my/org-agenda-cache-file "~/Documents/Notes/.cache" - "Path to the org-agenda cache file.") - -(defvar my/org-always-included-agenda-files - '("~/Documents/Notes/20220823172331-chores.org") - "Org files to always include in the agenda, even if no TODOs are found.") - (defun my/update-org-agenda-cache () "Scan Org files and cache those with TODOs, checkboxes, or timestamped entries." (interactive) - (let* ((org-dir "~/Documents/Notes/") + (let* ((org-dir my/org-base-dir) (files (directory-files-recursively org-dir "\\.org$")) (todo-files '()) (regex (concat @@ -837,39 +841,44 @@ templates for dailies, and nodes. | org-roam-dailies-find-yesterday | org roam dailies find yesterday | SPC n r d y | #+begin_src emacs-lisp :tangle ./config.el -(setq deft-directory "~/Documents/Notes/") +(setq deft-directory my/org-base-dir) (use-package org-roam :ensure t :custom - (org-roam-directory "~/Documents/Notes/") + (org-roam-directory my/org-base-dir) (org-roam-completion-everywhere t) (org-roam-dailies-capture-templates '(("d" "default" entry "* %<%I:%M %p>: %?" :if-new (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n")))) (org-roam-capture-templates - '(("d" "default" plain + `(("d" "default" plain "%?" :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n") :unnarrowed t) ("l" "programming language" plain - (file "/home/jawz/.local/share/doom/templates/programming.org") - :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+filetags: :programming:language:${title}:\n#+title: ${title}") + (file ,(expand-file-name "programming.org" my/doom-template-dir)) + :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" + "#+filetags: :programming:language:${title}:\n#+title: ${title}") :unnarrowed t) ("e" "political events" plain - (file "/home/jawz/.local/share/doom/templates/events.org") - :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+filetags: :politics:conflicts:\n#+title: ${title}") + (file ,(expand-file-name "events.org" my/doom-template-dir)) + :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" + "#+filetags: :politics:conflicts:\n#+title: ${title}") :unnarrowed t) ("p" "project" plain "* PROJ ${title}\n%?\n* Tasks" - :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+category: ${title}\n#+filetags: :project:\n#+title: ${title}") - :unnarrowed t) - )) + :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" + "#+category: ${title}\n#+filetags: :project:\n#+title: ${title}") + :unnarrowed t))) :bind() :bind-keymap() :config (org-roam-db-autosync-mode)) (setq completion-ignore-case t) -(set-file-template! "~/Documents/Notes/.+\\.org$" 'org-mode :ignore t) +(set-file-template! + (concat (regexp-quote my/org-base-dir) ".+\\.org$") + 'org-mode + :ignore t) #+end_src ** Org-Roam-UI