emacs - commit all stale emacs config
[dotfiles.git] / emacs.d / config / init-org.el
1
2 ;;; org-mode init File
3
4 ;; refer http://doc.norang.ca/org-mode.html
5
6 ;(add-to-list 'load-path (expand-file-name "~/git/org-mode/lisp"))
7 (add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode))
8 (require 'org)
9 ;;
10 ;; Standard key bindings
11 (global-set-key "\C-cl" 'org-store-link)
12 (global-set-key "\C-ca" 'org-agenda)
13 (global-set-key "\C-cb" 'org-iswitchb)
14
15
16 ;;(add-hook 'org-mode-hook
17 ;;          (lambda ()
18 ;;                      (org-set-local 'yas/trigger-key [tab])
19 ;;                      (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand)))
20
21
22 ;(org-indent-mode 1)
23
24
25 ;; org-todo
26 ;; define more state of todo
27 (setq org-todo-keywords
28       (quote ((sequence "TODO(t)" "STARTED(s)" "|" "DONE(d)")
29               (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" ))))
30
31 (setq org-todo-keyword-faces
32       (quote (("TODO" :foreground "red" :weight bold)
33               ("NEXT" :foreground "blue" :weight bold)
34               ("DONE" :foreground "forest green" :weight bold)
35               ("WAITING" :foreground "orange" :weight bold)
36               ("HOLD" :foreground "magenta" :weight bold)
37               ("CANCELLED" :foreground "forest green" :weight bold)
38               ("MEETING" :foreground "forest green" :weight bold)
39               ("PHONE" :foreground "forest green" :weight bold))))
40
41 (setq org-use-fast-todo-selection t)
42
43 ;; allow S-left/right to rotate state not set timestamp and add note
44 (setq org-treat-S-cursor-todo-selection-as-state-change nil)
45
46 ;; trigger a tags for the task when changing state
47 (setq org-todo-state-tags-triggers
48       (quote (("CANCELLED" ("CANCELLED" . t))
49               ("WAITING" ("WAITING" . t))
50               ("HOLD" ("WAITING") ("HOLD" . t))
51               (done ("WAITING") ("HOLD"))
52               ("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
53               ("NEXT" ("WAITING") ("CANCELLED") ("HOLD"))
54               ("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))
55
56
57 ;; org-capture
58 (setq org-directory "~/Private/org")
59 (setq org-default-notes-file (concat org-directory "/notes.org"))
60 (define-key global-map "\C-cc" 'org-capture)
61
62
63 (setq org-refile-targets (quote ((nil :maxlevel . 9)
64                                  (org-agenda-files :maxlevel . 9))))
65
66
67
68
69 ;; Capture templates for: TODO tasks, Notes, appointments, phone calls, meetings, and org-protocol
70 ;(setq org-capture-templates
71 ;      (quote (("t" "todo" entry (file "~/git/org/refile.org")
72 ;               "* TODO %?\n%U\n%a\n" :clock-in t :clock-resume t)
73 ;              ("r" "respond" entry (file "~/git/org/refile.org")
74 ;               "* NEXT Respond to %:from on %:subject\nSCHEDULED: %t\n%U\n%a\n" :clock-in t :clock-resume t :immediate-finish t)
75 ;              ("n" "note" entry (file "~/git/org/refile.org")
76 ;               "* %? :NOTE:\n%U\n%a\n" :clock-in t :clock-resume t)
77 ;              ("j" "Journal" entry (file+datetree "~/git/org/diary.org")
78 ;               "* %?\n%U\n" :clock-in t :clock-resume t)
79 ;              ("w" "org-protocol" entry (file "~/git/org/refile.org")
80 ;               "* TODO Review %c\n%U\n" :immediate-finish t)
81 ;              ("m" "Meeting" entry (file "~/git/org/refile.org")
82 ;               "* MEETING with %? :MEETING:\n%U" :clock-in t :clock-resume t)
83 ;              ("p" "Phone call" entry (file "~/git/org/refile.org")
84 ;               "* PHONE %? :PHONE:\n%U" :clock-in t :clock-resume t)
85 ;              ("h" "Habit" entry (file "~/git/org/refile.org")
86 ;               "* NEXT %?\n%U\n%a\nSCHEDULED: %(format-time-string \"%<<%Y-%m-%d %a .+1d/3d>>\")\n:PROPERTIES:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\n"))))
87
88
89 ;;; org-tag
90 ; Tags with fast selection keys
91 (setq org-tag-alist (quote ((:startgroup)
92                             ("@errand" . ?e)
93                             ("@office" . ?o)
94                             ("@home" . ?H)
95                             ("@farm" . ?f)
96                             (:endgroup)
97                             ("WAITING" . ?w)
98                             ("HOLD" . ?h)
99                             ("PERSONAL" . ?P)
100                             ("WORK" . ?W)
101                             ("FARM" . ?F)
102                             ("ORG" . ?O)
103                             ("NORANG" . ?N)
104                             ("crypt" . ?E)
105                             ("NOTE" . ?n)
106                             ("CANCELLED" . ?c)
107                             ("FLAGGED" . ??))))
108
109 ; Allow setting single tags without the menu
110 (setq org-fast-tag-selection-single-key (quote expert))
111
112 ; For tag searches ignore tasks with scheduled and deadline dates
113 (setq org-agenda-tags-todo-honor-ignore-options t)
114
115
116 ;; Always hilight the current agenda line
117 (add-hook 'org-agenda-mode-hook
118           '(lambda () (hl-line-mode 1))
119           'append)
120
121
122
123 ;; The following custom-set-faces create the highlights
124 (custom-set-faces
125   ;; custom-set-faces was added by Custom.
126   ;; If you edit it by hand, you could mess it up, so be careful.
127   ;; Your init file should contain only one such instance.
128   ;; If there is more than one, they won't work right.
129  '(org-mode-line-clock ((t (:background "grey75" :foreground "red" :box (:line-width -1 :style released-button)))) t))
130
131
132
133
134 (provide 'init-org)