diff --git a/dotfiles/.emacs.d/org.org b/dotfiles/.emacs.d/org.org index c49538a..f1e4e2f 100644 --- a/dotfiles/.emacs.d/org.org +++ b/dotfiles/.emacs.d/org.org @@ -1,5 +1,40 @@ Org is a package that allows you to create files like this one that look nice while also being able to run code. In this file, the code being run is stored in code blocks and all other text is disregarded. +* Function Definitions +** Refresh Org Agenda Files + +Creates a function to refresh the ~org-agenda-files~ variable to be set to include all org roam notes files. + +#+begin_src emacs-lisp +(defun jm/org-roam-refresh-agenda-list () + (interactive) + (let ((directory (expand-file-name org-roam-dailies-directory org-roam-directory))) + (setq org-agenda-files + (seq-filter + (lambda (file-path) (not (s-starts-with-p directory file-path))) + (org-roam-list-files))))) +#+end_src +** Custom Org-Roam Indexing Functions + +Before getting into the main config for Org-roam, I've created a few functions for better indexing nodes stored in the org-roam database. Specifically, these functions separate the org roam dailies nodes from other nodes. + +#+begin_src emacs-lisp +(defun jm/org-roam-find-filter (node) + (let ((directory (expand-file-name org-roam-dailies-directory org-roam-directory))) + (string= (file-name-directory (org-roam-node-file node)) + directory))) + +(defun jm/org-roam-dailies-find () + (interactive) + (org-roam-node-find nil nil #'jm/org-roam-find-filter)) + +(defun jm/org-roam-find () + (interactive) + (org-roam-node-find + nil nil + (lambda (node) (not (jm/org-roam-find-filter node))))) +#+end_src + * Org Setup This installs the org package and creates a setup function to enable/disable certain functionalities. @@ -14,7 +49,8 @@ This installs the org package and creates a setup function to enable/disable cer (add-to-list 'org-link-frame-setup '(file . find-file))) ; Open link in current window not other window. (use-package org - :hook (org-mode . jm/org-mode-setup) + :hook ((org-mode . jm/org-mode-setup) + (org-agenda-mode . jm/org-roam-refresh-agenda-list)) :config (setq jm/inbox-file (expand-file-name "inbox.org" jm/notes-directory) org-ellipsis " ▾" @@ -43,7 +79,6 @@ This installs the org package and creates a setup function to enable/disable cer #+end_src * Cosmetics - ** Org-Modern Org-Modern is a package that adds several features to emacs to make it look more /modern/. @@ -102,61 +137,19 @@ By default the syntax highlighting for latex/PDF documents exported with Emacs i (setq org-latex-src-block-backend 'engraved)) #+end_src -* Evil Org - -By default, many of the org specific keybindings do not feel intuitive when using evil mode. ~evil-org~ is a package that attempts to fix this by rebinding many of the default org keybindings to work better with Evil mode. - -#+begin_src emacs-lisp -(use-package evil-org - :after org - :hook (org-mode . (lambda () evil-org-mode)) - :config - (require 'evil-org-agenda) - (evil-org-agenda-set-keys)) -#+end_src - -* Org Agenda - -Org mode by default contains an /agenda/ system which is like a basic calendar that allows you to schedule todo items from org documents. All of the todo items from each org document are stored in a central area to allow for a formation of an /agenda/. - -#+begin_src emacs-lisp -(setq org-agenda-start-with-log-mode t) -(setq org-log-done 'time) -(setq org-log-into-drawer t) - -(setq org-priority-default ?D) -(setq org-priority-lowest ?D) -#+end_src - -** Refresh Org Agenda Files - -Creates a function to refresh the ~org-agenda-files~ variable to be set to include all org roam notes files. - -#+begin_src emacs-lisp -(defun jm/org-roam-refresh-agenda-list () - (interactive) - (let ((directory (expand-file-name org-roam-dailies-directory org-roam-directory))) - (setq org-agenda-files - (seq-filter - (lambda (file-path) (not (s-starts-with-p directory file-path))) - (org-roam-list-files))))) -#+end_src - -To use this function, I'll add it to some hooks to make sure to run it before the agenda list is needed. - -#+begin_src emacs-lisp -(advice-add 'org-agenda :before #'jm/org-roam-refresh-agenda-list) -(advice-add 'org-todo-list :before #'jm/org-roam-refresh-agenda-list) -(advice-add 'dashboard-get-agenda :before #'jm/org-roam-refresh-agenda-list) -#+end_src - +* Todo Items ** Custom States Adds custom states to tasks such as ~IN PROGRESS~, ~CANCELLED~, etc. I've also added some changes to the color of the todo items based on the status. For example, turning the task face orange if it is /in progress/. #+begin_src emacs-lisp -(setq org-todo-keyword-faces '(("IN PROGRESS" . (:foreground "orange" :weight bold)) - ("WAITING" . (:foreground "yellow" :weight bold)))) +(setq org-todo-keyword-faces + '(("IN PROGRESS" . (:foreground "orange" :weight bold)) + ("WAITING" . (:foreground "yellow" :weight bold)))) + +(setq org-modern-todo-faces + '(("IN PROGRESS" . (:background "orange" :foreground "black" :weight bold)) + ("WAITING" . (:background "yellow" :foreground "black" :weight bold)))) (setq org-todo-keywords '((sequence @@ -179,7 +172,7 @@ Adds a hook to repeated tasks in org agenda that, when repeated, checkboxes will (add-hook 'org-todo-repeat-hook #'org-reset-checkbox-state-subtree) #+end_src -** Automatically Add Todo UUIDs +** Automatic UUIDs #+begin_src emacs-lisp (add-hook 'org-after-todo-state-change-hook @@ -187,34 +180,22 @@ Adds a hook to repeated tasks in org agenda that, when repeated, checkboxes will (org-id-get-create)))) #+end_src -* Org Roam +** Org Agenda -Org-roam is a plain-text knowledge management system. It brings some of Roam's more powerful features into the Org-mode ecosystem such as org-file linking, etc. - -** Custom Indexing Functions - -Before getting into the main config for Org-roam, I've created a few functions for better indexing nodes stored in the org-roam database. Specifically, these functions separate the org roam dailies nodes from other nodes. +Org mode by default contains an /agenda/ system which is like a basic calendar that allows you to schedule todo items from org documents. All of the todo items from each org document are stored in a central area to allow for a formation of an /agenda/. #+begin_src emacs-lisp -(defun jm/org-roam-find-filter (node) - (let ((directory (expand-file-name org-roam-dailies-directory org-roam-directory))) - (string= (file-name-directory (org-roam-node-file node)) - directory))) +(setq org-agenda-start-with-log-mode t) +(setq org-log-done 'time) +(setq org-log-into-drawer t) -(defun jm/org-roam-dailies-find () - (interactive) - (org-roam-node-find nil nil #'jm/org-roam-find-filter)) - -(defun jm/org-roam-find () - (interactive) - (org-roam-node-find - nil nil - (lambda (node) (not (jm/org-roam-find-filter node))))) +(setq org-priority-default ?D) +(setq org-priority-lowest ?D) #+end_src -** Main Config +* Org Roam -Below is the main config for org-roam. +Org-roam is a plain-text knowledge management system. It brings some of Roam's more powerful features into the Org-mode ecosystem such as org-file linking, etc. Below is the main config for org-roam. #+begin_src emacs-lisp (use-package org-roam @@ -286,7 +267,21 @@ Consult Org Roam is a package that integrates searching from consult with ~org-r :init (consult-org-roam-mode 1)) #+end_src -* Fix Snippets +* Other Packages +** Evil Org + +By default, many of the org specific keybindings do not feel intuitive when using evil mode. ~evil-org~ is a package that attempts to fix this by rebinding many of the default org keybindings to work better with Evil mode. + +#+begin_src emacs-lisp +(use-package evil-org + :after org + :hook (org-mode . (lambda () evil-org-mode)) + :config + (require 'evil-org-agenda) + (evil-org-agenda-set-keys)) +#+end_src + +** Fix Snippets This is required as of org 9.2 as snippets such as ~