aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d/rul-lisp/packages/rul-org.el
blob: f75ae7f4850d6630f4831e0a3da6577321207b5c (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
153
154
155
156
157
158
159
;; Debian packages: elpa-org
;; Elpa packages: org-modern
(require 'org)
(require 'org-capture)
(require 'org-protocol)
(require 'org-habit)

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

(setq org-attach-use-inheritance t)
(setq org-cycle-separator-lines 0)
(setq org-hide-leading-stars nil)
(setq org-startup-indented t)
(setq org-edit-src-content-indentation 0)

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

;; (add-hook 'org-mode-hook 'turn-off-auto-fill)
;; (add-hook 'auto-save-hook 'org-save-all-org-buffers)
(add-hook 'org-mode-hook 'visual-line-mode)

(use-package org-download
  :ensure t
  :config
  (add-hook 'dired-mode-hook 'org-download-enable))

(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@/!)" "MEETING"))))

(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)

        ("e" "Elfeed entry" entry
         (file+headline org-refile-path "Read later")
         "* %? [[%:link][%:description]]\n  %U\n  %:description\n")

        ("L" "Web Link" entry
         (file+headline org-refile-path "Read later")
         "* %?[[%:link][%:description]] \"\")\n %:initial\n \nCaptured On: %U"
         )

        ("l" "Web Link with Selection" entry
         (file+headline org-refile-path "Read later")
         "* [[%:link][%:description]] \n %:initial\n \nCaptured On: %U")

        )))

;; 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)

;; Honor ATTR_ORG attribute. Defaults to image's width if not set.
(setq org-image-actual-width nil)

(provide 'rul-org)
nihil fit ex nihilo