summaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/org-mode.el
blob: 3d9de33b8e0a75191b51eb1eebfccce94b9cc0d0 (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
;; --- CUSTOM DEFINITIONS AND FUNCTIONS ---
(setq
 ;; list of TODO statuses that are actionable
 bab/org-todos-actionable '("TODO" "STARTED")
 )

(defun bab/org-get-todo (entry)
  (org-entry-get (get-text-property 0 'org-marker entry) "TODO" nil))

(defun bab/org-todo-actionable-p (todo)
  (if (member todo bab/org-todos-actionable) t nil))

(defun bab/org-entry-actionable-p (entry)
  (bab/org-todo-actionable-p (bab/org-get-todo entry)))

(defun bab/org-cmp-actionable (a b)
  (if (bab/org-entry-actionable-p a) nil t))

(defun bab/org-agenda ()
  "My own custom org agenda"
  (interactive)
  (org-ql-search (org-agenda-files)
    '(and
      (todo)
      (not (done))        ;; maybe allow entries that were completed today?
      (not (org-entry-blocked-p))
      (or
       (deadline auto)    ;; deadline near enough to care about
       (not (deadline))   ;; or no deadline at all
       (scheduled)
       (ts-active :on today)))
    :title "My Agenda"
    :sort '(priority deadline)
    :super-groups
    '((:name "Scheduled Later"
             :scheduled future
             :order 8)
      (:name "Overdue"
             :deadline past)
      (:name "Today"
             :deadline today
             :scheduled past
             :scheduled today)
      (:name "Some Day"
             :deadline nil
             :order 9)
      (:name "Waiting"
             :pred (lambda (entry) (not (bab/org-entry-actionable-p entry)))
             :order 8)
      (:auto-property "TYPE")
      (:name "Upcoming"
             :anything t)
      )))

(defun bab/org-agenda-test ()
  "My own custom org agenda"
  (interactive)
  (org-ql-search (org-agenda-files)
    '(and
      (not (done))        ;; maybe allow entries that were completed today?
      (not (org-entry-blocked-p))
      (or
       (deadline auto)    ;; deadline near enough to care about
       (not (deadline))   ;; or no deadline at all
       (scheduled :to today)
       (ts-active :on today)))
    :title "My Agenda - TEST"
    :sort '(priority deadline)
    :super-groups
    '((:name "FIRST"
             :deadline past
             :deadline today))))

(setq org-agenda-custom-commands
      '(("w" "Work Agenda"
         ((agenda "" ((org-agenda-span 1)
                      (org-agenda-sorting-strategy '(time-up scheduled-down priority-down deadline-up))
                      (org-super-agenda-groups
                       '((:name "Waiting" :todo "WAIT" :order 9)
                         (:anything t)))))
          (alltodo "" ((org-agenda-overriding-header "")
                       (org-agenda-skip-function '(org-agenda-skip-if nil '(scheduled deadline)))
                       (org-super-agenda-groups
                        '((:todo "TLG")
                          (:name "Some day" :anything t))))))
       )))

;; --- CONFIGURATION ---
(define-key global-map "\C-cc" 'org-capture)

(setq
 ;; Use priorities A-E, default priority is C
 org-highest-priority ?A
 org-lowest-priority  ?E
 org-default-priority ?C

 ;; TODO states and sequences
 org-todo-keywords
 '((sequence "TODO(t)" "STARTED(s)" "WAIT(w)" "|" "DONE(d)")
   (sequence "|" "CANCELED(x)"))
 org-todo-keyword-faces
 '(("WAIT"     . (:foreground "DodgerBlue1"))
   ("STARTED"  . (:foreground "orchid1"))
   ("CANCELED" . (:foreground "snow4")))

 ;; Blank capture templates, so local  config can add to it
 org-capture-templates ()

 ;; Agenda
 org-agenda-files '("~/org/agenda")
 org-agenda-overriding-columns-format "%1PRIORITY %DEADLINE %TODO %CLOCKSUM %80ITEM"
 org-agenda-dim-blocked-tasks 'invisible
 org-agenda-span 7
 org-agenda-show-all-dates t
 org-agenda-skip-deadline-if-done t
 org-agenda-skip-deadline-prewarning-if-scheduled t
 org-agenda-skip-scheduled-if-done t
 org-agenda-start-on-weekday nil

 ;; Misc configuration
 org-deadline-warning-days 7
 org-default-notes-file "~/org/notes"
 org-enforce-todo-dependencies t
 org-fast-tag-selection-single-key (quote expert)
 org-return-follows-link t
 org-reverse-note-order t
 org-use-property-inheritance t
 )