diff options
author | Thanos Apollo <[email protected]> | 2023-09-03 17:05:49 +0300 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2023-09-03 17:06:54 +0300 |
commit | 8efa6f3f1db166d30a4eb38780f6c47855c51439 (patch) | |
tree | 873e0c0aeb443c10153a44e14a3d89c938e68e4d /.emacs.d/modules/thanos-org-roam.el | |
parent | f7c3db0c688b9b98762464cc9e4cc7c87a9dbe96 (diff) |
emacs: Modularize
Diffstat (limited to '.emacs.d/modules/thanos-org-roam.el')
-rw-r--r-- | .emacs.d/modules/thanos-org-roam.el | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/.emacs.d/modules/thanos-org-roam.el b/.emacs.d/modules/thanos-org-roam.el new file mode 100644 index 0000000..1eeaa4b --- /dev/null +++ b/.emacs.d/modules/thanos-org-roam.el @@ -0,0 +1,105 @@ +;;; org-roam.el --- org roam config -*- lexical-binding: t; -*- + +;; Copyright (C) 2023 Thanos Apollo + +;; Author: Thanos Apollo <[email protected]> +;; Keywords: + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; + +;;; Code: + +(require 'org-roam) + +;; Create ~/Notes, ignore errors if it's already made +(ignore-errors + (make-directory "~/Notes")) + +(setf org-roam-directory "~/Notes" + org-roam-dailies-directory "journal/") + +(org-roam-db-autosync-enable) + +(setf org-roam-node-display-template (concat "${title:50} "(propertize "${tags:30}" 'face 'org-tag))) + +(setf org-roam-db-node-include-function + (lambda () + (not (or (member "journal" (org-get-tags)) + (member "memorize" (org-get-tags)))))) + +;; Functions +(defun org-insert-book () + "Insert org-link from ~/Library for book" + (interactive) + (let* ((book-path (read-file-name "Book: " "~/Library/"))) + (org-insert-link nil book-path (file-name-base book-path)))) + +;;; Keybindings +(define-key org-mode-map (kbd "C-c b") 'org-insert-book) + +;; Set maps +(define-prefix-command 'thanos/notes) +(global-set-key (kbd "C-c n") 'thanos/notes) +;; org-roam keys +(define-key thanos/notes (kbd "t") 'org-roam-buffer-toggle) +(define-key thanos/notes (kbd "f") 'org-roam-node-find) +(define-key thanos/notes (kbd "i") 'org-roam-node-insert) +;; Journaling +(define-prefix-command 'Journal) +(define-key thanos/notes (kbd "C-j") 'Journal) +(define-key Journal (kbd "d") 'Journaling/dailies) +(define-key Journal (kbd "C-c") 'org-roam-dailies-capture-today) +(define-key Journal (kbd "C-t") 'org-roam-dailies-capture-tomorrow) +(define-key Journal (kbd "C-y") 'org-roam-dailies-capture-yesterday) +(define-key Journal (kbd "c") 'org-roam-dailies-goto-today) +(define-key Journal (kbd "t") 'org-roam-dailies-goto-tomorrow) +(define-key Journal (kbd "y") 'org-roam-dailies-goto-yesterday) + +(define-key org-mode-map (kbd "C-c C-.") 'org-roam-tag-add) +(define-key org-mode-map (kbd "C-c i") 'org-id-get-create) + +;; Templates +(setf org-roam-capture-templates + '(("d" "default" plain + "%?" + :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n") + :unnarrowed t) + ("l" "programming language" plain + "* Characteristics\n\n- Family: %?\n- Inspired by: \n\n* Reference:\n\n" + :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n") + :unnarrowed t) + ("p" "MUS" plain "* Goals\n\n%?\n\n* Tasks\n\n** TODO Add initial tasks\n\n* Dates\n\n" + :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: MUS") + :unnarrowed t))) +;; Dailies +(setf org-roam-dailies-capture-templates + '(("d" "default" entry + "* %?" + :target (file+head "%<%Y-%m-%d>.org" + "#+title: %<%Y-%m-%d>\n")) + ("j" "Daily Journaling" entry + (file "~/org/Templates/journaling.org") + :target (file+head "%<%Y-%m-%d>.org" + "#+title: %<%Y-%m-%d>\n")) + ("i" "Improve" entry + (file "~/org/Templates/improve.org") + :target (file+head "%<%Y-%m-%d>.org" + "#+title: %<%Y-%m-%d>\n")))) + +(provide 'thanos-org-roam) +;;; org-roam.el ends here |