about summary refs log tree commit diff
path: root/configs/shared/emacs/.emacs.d/wpc/packages/wpc-org.el
blob: 03b52ba27247f4efddcef65510f4dfde54ade6fc (plain) (blame)
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
;;; org.el --- My org preferences -*- lexical-binding: t -*-
;; Author: William Carroll <wpcarro@gmail.com>

;;; Commentary:
;; Hosts my org mode preferences

;;; Code:

;; TODO: figure out how to nest this in (use-package org ...)
(setq org-capture-templates
      `(

        ("w" "work" entry (file+headline
                           ,(f-join (getenv "ORG_DIRECTORY") "work.org")
                           "Tasks")
         "* TODO %?")

        ("p" "personal" entry (file+headline
                               ,(f-join (getenv "ORG_DIRECTORY") "personal.org")
                               "Tasks")
         "* TODO %? ")

        ("i" "ideas" entry (file+headline
                            ,(f-join (getenv "ORG_DIRECTORY") "ideas.org")
                            "Tasks")
         "* %? ")

        ("s" "shopping list" entry (file+headline
                            ,(f-join (getenv "ORG_DIRECTORY") "shopping.org")
                            "Items")
         "* TODO %? ")

        ))
(evil-set-initial-state 'org-mode 'insert)

(use-package org
  :config
  (general-add-hook 'org-mode-hook
                    ;; TODO: consider supporting `(disable (list linum-mode company-mode))'
                    (list (disable linum-mode)
                          (disable company-mode)))
  (general-define-key :prefix "C-c"
           "l" #'org-store-link
           "a" #'org-agenda
           "c" #'org-capture)
  (setq org-todo-keywords
        '((sequence "TODO" "BLOCKED" "DONE")))
  (setq org-default-notes-file (f-join (getenv "ORG_DIRECTORY") "notes.org"))
  (setq org-agenda-files (list (f-join (getenv "ORG_DIRECTORY") "work.org")
                               (f-join (getenv "ORG_DIRECTORY") "personal.org")))
  ;; TODO: troubleshoot why `wpc/kbds-minor-mode', `wpc/ensure-kbds' aren't
  ;; enough to override the following KBDs. See this discussion for more context
  ;; on where the idea came from:
  ;; https://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs
  (general-unbind 'normal org-mode-map "M-h" "M-j" "M-k" "M-l"))

(use-package org-bullets
  :after (org)
  :config
  (general-add-hook 'org-mode-hook (enable org-bullets-mode)))

;; i3, `org-mode' integration
;; Heavily influenced by: https://somethingsomething.us/post/i3_and_orgmode/
(defadvice org-switch-to-buffer-other-window
    (after supress-window-splitting activate)
  "Delete the extra window if we're in a capture frame."
  (if (equal "org-protocol-capture" (wpc/frame-name))
      (delete-other-windows)))

(add-hook 'org-capture-after-finalize-hook
          (lambda ()
            (when (equal "org-protocol-capture" (wpc/frame-name))
                (delete-frame))))

(provide 'wpc-org)
;;; wpc-org.el ends here