summaryrefslogtreecommitdiff
path: root/.emacs.d/snippets/org-config.el
blob: d3f48ec4057a1526ed95e3101cdc79d0bb9ddc0c (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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)))