aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d/rul-lisp/packages/rul-org.el
blob: 72f74b1eb7b7010b9cccef07b5b68b87591fdd74 (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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
;; Debian packages: elpa-org
;; Elpa packages: org-modern
(require 'org)
(require 'org-capture)
(require 'org-protocol)
(require 'org-habit)

(require 'rul-config-org)

(require 'rul-org-agenda)
(require 'rul-org-journal)
(require 'rul-org-roam)


(setq org-cycle-separator-lines 0)
(setq org-startup-indented t)
(setq org-hide-leading-stars nil)

(use-package org-modern :ensure t)
(use-package org-pomodoro :ensure t)

(add-hook 'org-mode-hook 'turn-off-auto-fill)
(add-hook 'org-mode-hook 'visual-line-mode)

(setq org-startup-indented t
      org-pretty-entities nil
      org-hide-emphasis-markers t
      ;; show actually italicized text instead of /italicized text/
      org-fontify-whole-heading-line t
      org-fontify-done-headline t
      org-fontify-quote-and-verse-blocks t)

;; ORG BINDINGS ;;
(global-set-key (kbd "C-c l") #'org-store-link)
(global-set-key (kbd "C-c c") #'org-capture)
(global-set-key (kbd "C-c s") #'org-schedule)

;; ORG STATES ;;
(setq org-todo-keywords
      (quote ((sequence "TODO(t)" "MAYBE(m)" "NEXT(n)" "|" "DONE(d)")
              (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)"))))

(setq org-use-fast-todo-selection t)

(setq org-todo-state-tags-triggers
      (quote (("CANCELLED" ("CANCELLED" . t))
              ("WAITING" ("WAITING" . t))
              ("HOLD" ("WAITING") ("HOLD" . t))
              (done ("WAITING") ("HOLD"))
              ("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
              ("NEXT" ("WAITING") ("CANCELLED") ("HOLD"))
              ("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))

(setq org-enforce-todo-dependencies t)
(setq org-log-done (quote time))
(setq org-log-redeadline (quote time))
(setq org-log-reschedule (quote time))

;; CAPTURE ;;
(setq org-default-notes-file org-refile-path)
(setq org-capture-templates
      (quote
       (
        ("w" "Todo" entry (file+headline org-refile-path "Tasks")
         "* TODO "
         :empty-lines 1)
        ("m"
         "Capture incoming email"
         entry
         (file+headline org-refile-path "Incoming")
         "* TODO Re: %:description\n\n  Source: %u, %a\n"
         :empty-lines 1)
        )))

(add-hook 'org-capture-mode-hook 'delete-other-windows)
(setq org-protocol-flag nil)

(defadvice org-capture-finalize (after delete-frame-at-end activate)
  "Delete frame at remember finalization"
  (progn (if org-protocol-flag (delete-frame))
         (setq org-protocol-flag nil)))

(defadvice org-capture-kill (after delete-frame-at-end activate)
  "Delete frame at remember abort"
  (progn (if org-protocol-flag (delete-frame))
         (setq org-protocol-flag nil)))

(defadvice org-protocol-capture (before set-org-protocol-flag activate)
  (setq org-protocol-flag t))


;; REFILE ;;

; Targets include this file and any file contributing to the agenda - up to 3 levels deep
(setq org-refile-targets
      '((nil :maxlevel . 3)
        (org-agenda-files :maxlevel . 3)))

; Targets complete directly with IDO
(setq org-outline-path-complete-in-steps nil)

; Allow refile to create parent tasks with confirmation
(setq org-refile-allow-creating-parent-nodes (quote confirm))



;; ORG REPORTS ;;
; Set default column view headings: Task Effort Clock_Summary
(setq org-columns-default-format "%80ITEM(Task) %10Effort(Effort){:} %10CLOCKSUM")

(defun my-org-clocktable-indent-string (level)
  (if (= level 1)
      ""
    (let ((str "^"))
      (while (> level 2)
        (setq level (1- level)
              str (concat str "--")))
      (concat str "-> "))))

(advice-add 'org-clocktable-indent-string :override #'my-org-clocktable-indent-string)

(setq org-clock-clocktable-default-properties '(:maxlevel 4 :scope file :formula %))

; global Effort estimate values
; global STYLE property values for completion
(setq org-global-properties (quote (("Effort_ALL" . "0:15 0:30 0:45 1:00 2:00 3:00 4:00 5:00 6:00 0:00")
                                    ("STYLE_ALL" . "habit"))))

;; TAGS ;;
; Tags with fast selection keys
(setq org-tag-alist (quote ((:startgroup)
                            ("@errand" . ?e)
                            ("@office" . ?o)
                            ("@home" . ?H)
                            (:endgroup)
                            ("WAITING" . ?w)
                            ("HOLD" . ?h)
                            ("CANCELLED" . ?c)
                            ("FLAGGED" . ??))))

(setq org-stuck-projects
      '("+LEVEL=2+PROJECT/-MAYBE-DONE" ("NEXT") ("@shop")
        "\\<IGNORE\\>"))

; Allow setting single tags without the menu
(setq org-fast-tag-selection-single-key (quote expert))

;; org-modern
(add-hook 'org-mode-hook 'org-modern-mode)
(add-hook 'org-agenda-finalize-hook #'org-modern-agenda)

(provide 'rul-org)
nihil fit ex nihilo