summaryrefslogtreecommitdiff
path: root/.emacs.d/modules/thanos-org.el
diff options
context:
space:
mode:
Diffstat (limited to '.emacs.d/modules/thanos-org.el')
-rw-r--r--.emacs.d/modules/thanos-org.el273
1 files changed, 273 insertions, 0 deletions
diff --git a/.emacs.d/modules/thanos-org.el b/.emacs.d/modules/thanos-org.el
new file mode 100644
index 0000000..b1f3d43
--- /dev/null
+++ b/.emacs.d/modules/thanos-org.el
@@ -0,0 +1,273 @@
+;;; thanos-org-config.el --- org 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)
+(require 'org-agenda)
+
+(setf org-directory "~/org/"
+ org-agenda-files '("~/org/agenda.org")
+ org-default-notes-file (expand-file-name "notes.org" org-directory)
+ org-ellipsis " ▼ "
+ org-log-done 'time
+ org-hide-emphasis-markers nil ;;change to t to hide emphasis markers
+ org-table-convert-region-max-lines 20000
+ org-log-done 'time
+ org-log-into-drawer t
+ org-todo-keywords ;; This overwrites the default Doom org-todo-keywords
+ '((sequence
+ "TODO(t)" ;; A task that is ready to be tackled
+ "BLOG(b)" ;; Blog writing assignments
+ "GYM(g)" ;; Things to accomplish at the gym
+ "WAIT(w)" ;; Something is holding up this task
+ "|" ;; The pipe necessary to separate "active" states and "inactive" states
+ "DONE(d)" ;; Task has been completed
+ "CANCELLED(c)" )))
+
+(define-key org-mode-map (kbd "C-c t") 'org-time-stamp-inactive)
+(define-key org-mode-map (kbd "C-c s") 'org-download-screenshot)
+
+(add-hook 'org-mode-hook 'thanos/org-theme-gruvbox)
+(add-hook 'org-mode-hook 'flyspell-mode)
+(add-hook 'org-mode-hook 'toc-org-mode)
+
+(defadvice org-edit-src-code (around set-buffer-file-name activate compile)
+ (let ((file-name (buffer-file-name))) ;; (1)
+ ad-do-it ;; (2)
+ (setf buffer-file-name file-name))) ;; (3)
+
+(org-babel-do-load-languages
+ 'org-babel-load-languages
+ '((emacs-lisp . t)
+ (python . t)))
+
+
+(setf org-structure-template-alist
+ '(("e" . "src emacs-lisp")
+ ("p" . "src python")
+ ("l" . "src lisp")
+ ("b" . "src bash")
+ ("q" . "QUOTE")))
+
+;;Auto tangle
+(add-hook 'org-mode-hook 'org-auto-tangle-mode)
+
+
+;; Org roam
+(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"))))
+
+;; Org themes
+
+(require 'org)
+(require 'org-modern)
+(require 'org-agenda)
+(require 'org)
+
+(defun thanos/org-theme-dracula ()
+ "Enable Dracula theme for Org headers."
+ (interactive)
+ (dolist
+ (face
+ '((org-level-1 1.7 "#8be9fd" extra-bold)
+ (org-level-2 1.6 "#bd93f9" extra-bold)
+ (org-level-3 1.5 "#50fa7b" bold)
+ (org-level-4 1.4 "#ff79c6" semi-bold)
+ (org-level-5 1.3 "#9aedfe" normal)
+ (org-level-6 1.2 "#caa9fa" normal)
+ (org-level-7 1.1 "#5af78e" normal)
+ (org-level-8 1.0 "#ff92d0" normal)))
+ (set-face-attribute (nth 0 face) nil
+ :font "JetBrains Mono"
+ :weight (nth 3 face)
+ :height (nth 1 face)
+ :foreground (nth 2 face)))
+ (set-face-attribute 'org-table nil
+ :font "JetBrains Mono"
+ :weight 'normal
+ :height 1.0
+ :foreground "#bfafdf"))
+
+(defun thanos/org-theme-darkone ()
+ "Enable Darkone theme for Org headers."
+ (interactive)
+ (dolist
+ (face
+ '((org-level-1 1.70 "#51afef" bold)
+ (org-level-2 1.55 "#7FBCD2" bold)
+ (org-level-3 1.40 "#da8548" bold)
+ (org-level-4 1.20 "#da8548" semi-bold)
+ (org-level-5 1.20 "#5699af" normal)
+ (org-level-6 1.20 "#a9a1e1" normal)
+ (org-level-7 1.10 "#46d9ff" normal)
+ (org-level-8 1.00 "#ff6c6b" normal)))
+ (set-face-attribute (nth 0 face) nil
+ :font "Jetbrains Mono"
+ :weight (nth 3 face)
+ :height (nth 1 face)
+ :foreground (nth 2 face)))
+ (set-face-attribute 'org-table nil
+ :font "Jetbrains Mono"
+ :weight 'normal
+ :height 1.0
+ :foreground "#A66CFF"))
+
+(defun thanos/org-theme-gruvbox ()
+ "Enable Darkone theme for Org headers."
+ (interactive)
+ (dolist
+ (face
+ '((org-level-1 1.70 "#fb4934" bold)
+ (org-level-2 1.55 "#98971a" bold)
+ (org-level-3 1.40 "#458588" bold)
+ (org-level-4 1.20 "#b16286" semi-bold)
+ (org-level-5 1.20 "#689d6a" normal)
+ (org-level-6 1.20 "#d3869b" normal)
+ (org-level-7 1.10 "#8ec07c" normal)
+ (org-level-8 1.00 "#ebdbb2" normal)))
+ (set-face-attribute (nth 0 face) nil
+ :font "Jetbrains Mono"
+ :weight (nth 3 face)
+ :height (nth 1 face)
+ :foreground (nth 2 face)))
+ (set-face-attribute 'org-table nil
+ :font "Jetbrains Mono"
+ :weight 'normal
+ :height 1.0
+ :foreground "#A66CFF"))
+
+(modify-all-frames-parameters
+ '((right-divider-width . 5)
+ (internal-border-width . 5)))
+(dolist (face '(window-divider
+ window-divider-first-pixel
+ window-divider-last-pixel))
+ (face-spec-reset-face face)
+ (set-face-foreground face (face-attribute 'default :background)))
+(set-face-background 'fringe (face-attribute 'default :background))
+
+(setf
+ ;; Edit settings
+ org-auto-align-tags nil
+ org-tags-column 0
+ org-fold-catch-invisible-edits 'show-and-error
+ org-special-ctrl-a/e t
+ org-insert-heading-respect-content t
+
+ ;; Org styling, hide markup etc.
+ org-hide-emphasis-markers t
+ org-pretty-entities t
+
+ ;; Agenda styling
+ org-agenda-tags-column 0
+ org-agenda-block-separator ?─
+ org-agenda-time-grid
+ '((daily today require-timed)
+ (800 1000 1200 1400 1600 1800 2000)
+ " ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄")
+ org-agenda-current-time-string
+ "⭠ now ─────────────────────────────────────────────────")
+
+(global-org-modern-mode)
+
+(setf org-modern-todo nil)
+
+
+(provide 'thanos-org)
+;;; thanos-org-config.el ends here