diff options
Diffstat (limited to '.emacs.d/snippets')
-rw-r--r-- | .emacs.d/snippets/org-config.el | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/.emacs.d/snippets/org-config.el b/.emacs.d/snippets/org-config.el new file mode 100644 index 0000000..d3f48ec --- /dev/null +++ b/.emacs.d/snippets/org-config.el @@ -0,0 +1,127 @@ +(require 'org) +(require 'org-agenda) +(require 'org-superstar) +(require 'org-tempo) + +(defun apollo/org-mode-setup () + (setq evil-auto-indent nil) + (apollo/org-theme-dracula)) + +(add-hook 'org-mode-hook 'apollo/org-mode-setup) +(add-hook 'org-mode-hook 'org-superstar-mode) + +(setq 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-agenda-start-log-mode t + org-log-done 'time + org-log-into-drawer t + org-indent-mode 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)" )) + org-superstar-headline-bullets-list '("◉" "●" "○" "●" "○" "●" "◆") + org-superstar-itembullet-alist '((?+ . ?➤) (?- . ?✦))) ;; changes +/- symbols in item lists) + +;; Use either org-bullets or org-superstar +;; (use-package org-bullets +;; :after org +;; :hook (org-mode . org-bullets-mode) +;; :custom +;; (org-bullets-bullet-list '("●" "○" "●" "○" "●" "●" ))) + +;; Org Themes +(defun apollo/org-theme-darkone () + "Enable Darkone theme for Org headers." + (interactive) + (dolist + (face + '((org-level-1 1.70 "#51afef" ultra-bold) + (org-level-2 1.55 "#7FBCD2" extra-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 apollo/org-theme-dracula () + "Enable Dracula theme for Org headers." + (interactive) + (dolist + (face + '((org-level-1 1.7 "#8be9fd" ultra-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 apollo/org-mode-visual () + (interactive) + (setq visual-fill-column-width 100 + visual-fill-column-center-text t) + (visual-fill-column-mode 1)) +(defun apollo/org-mode-visual-undo () + (interactive) + (setq visual-fill-column-width 2000 + visual-fill-column-center-text nil) + (visual-fill-column-mode 1)) + +(defadvice org-edit-src-code (around set-buffer-file-name activate compile) + (let ((file-name (buffer-file-name))) ;; (1) + ad-do-it ;; (2) + (setq buffer-file-name file-name))) ;; (3) + +(org-babel-do-load-languages + 'org-babel-load-languages + '((emacs-lisp . t) + (python . t))) + +(add-to-list 'org-structure-template-alist '("sh" . "src shell")) +(add-to-list 'org-structure-template-alist '("b" . "src shell")) +(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) +(add-to-list 'org-structure-template-alist '("py" . "src python")) + +;; Automatically tangle our Emacs.org config file when we save it +(defun apollo/org-babel-tangle-config () + (when (string-equal (buffer-file-name) + (expand-file-name "~/.emacs.d/emacs.org" + "~/.config/qtile/README.org")) + ;; Dynamic scoping to the rescue + (let ((org-confirm-babel-evaluate nil)) + (org-babel-tangle)))) + +(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'apollo/org-babel-tangle-config))) |