-
Notifications
You must be signed in to change notification settings - Fork 0
/
org-config-thierry.el
193 lines (159 loc) · 6.8 KB
/
org-config-thierry.el
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
;;; org-config-thierry.el --- My config for org
;;
;; Author: Thierry Volpiatto
;; Maintainer: Thierry Volpiatto
;;
;; Created: jeu. avril 2 14:10:06 2009 (+0200)
;; Version:
;; URL:
;; Keywords:
;; Compatibility:
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 3, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;
;;; Commentary:
;;
;;
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Code:
;(require 'org)
;; auto-fill-mode
;; (set to 78 in files)
(add-hook 'org-mode-hook 'auto-fill-mode)
;; Use-enter-to-follow-links
(setq org-return-follows-link t)
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(setq org-agenda-files '("~/org"))
;; Todo-rules
;; (find-node "(org)Fast access to TODO states")
(setq org-todo-keywords
'((sequence "TODO(t)" "|" "INPROGRESS(i)" "DONE(d)" "CANCELED(c)" "DEFERRED(s)")))
(setq org-todo-keyword-faces
'(("TODO" . ((:foreground "red")))
("INPROGRESS" . ((:foreground "yellow")))
("BUGREPORT" . ((:foreground "VioletRed4" :weight bold)))
("FIXED" . ((:foreground "SpringGreen4" :weight bold)))
("DEFERRED" . shadow)
("CANCELED" . ((:foreground "blue" :weight bold)))))
(setq org-log-done 'time)
(setq org-use-fast-todo-selection t)
(setq org-reverse-note-order t)
;; Tags-setting
;; (info "(org)Setting tags")
(setq org-tag-alist '(("@entrainement" . ?E)
("@climbing" . ?c)
("Equipement" . ?e)
("@github" . ?d)
("Helm" . ?h)
("crypt" . ?C)
("@travel" . ?t)))
;; org-capture
(setq org-default-notes-file (expand-file-name "notes.org" org-directory))
(setq org-capture-templates
'(("t" "Todo" entry (file+headline "~/org/agenda.org" "Tasks") "** TODO %?\n %i\n %a" :prepend t)
("n" "Notes" entry (file+headline "~/org/notes.org" "General") "* %T %?\n\n %i\n" :prepend t)
("E" "Entrainement" entry (file+headline "~/org/notes.org" "Entrainement") "* %T %?\n\n %i\n" :prepend t)
("H" "Helm" entry (file+headline "~/org/notes.org" "Notes helm") "* %^{Title}\n %i\n %a" :prepend t)
("l" "Lisp" entry (file+headline "~/org/notes.org" "Notes elisp") "* %^{Title}\n %i\n %a" :prepend t)
("p" "Python" entry (file+headline "~/org/notes.org" "Notes python") "* %^{Title}\n %i\n %a" :prepend t)
("b" "Bash" entry (file+headline "~/org/notes.org" "Notes bash") "* %^{Title}\n %i\n %a" :prepend t)
("L" "Linux" entry (file+headline "~/org/notes.org" "Memo Linux") "* %^{Title}\n %i\n %a" :prepend t)
))
(global-set-key (kbd "C-c r") 'org-capture)
;; org-annotation-helper
(require 'org-annotation-helper)
;; Diary-integration-in-org
(setq org-agenda-include-diary t) ; show also content of regular diary file.
;; Insinuate-appt
(require 'appt)
;; When use 'r' (rebuild agenda) reload appt
(add-hook 'org-agenda-mode-hook #'(lambda ()
(setq appt-time-msg-list nil)
(define-key org-agenda-mode-map (kbd "C-c M") 'org-agenda-month-view)))
(setq appt-display-format 'window) ; Values: 'echo, 'window or nil.
(appt-activate 1)
;; Subtasks
(defun org-summary-todo (n-done n-not-done)
"Switch entry to DONE when all subentries are done, to TODO otherwise."
(let (org-log-done org-log-states) ; turn off logging
(org-todo (if (= n-not-done 0) "DONE" "TODO"))))
(add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
;; leave-a-blank-line-when-insert-new-item
(setq org-blank-before-new-entry '((heading . t)
(plain-list-item . nil)))
(defun tv/insert-org-src-keyword (beg end)
(interactive "r")
(save-excursion
(goto-char beg)
(insert "#+begin_src\n")
(goto-char end)
(forward-line 1)
(insert "\n#+end_src")))
(define-key org-mode-map (kbd "<f11> o") 'helm-org-in-buffer-headings)
(define-key org-mode-map (kbd "<f11> k") 'tv/insert-org-src-keyword)
;; Colorize-Diary's-entries-in-agenda
(defvar tv-diary-regexp "^ *[Dd]iary")
(defvar tv-diary-done-regexp "^ *[Dd]iary.* *==> *done$")
(defun tv-org-propertize-diary-entries ()
(save-excursion
(let ((inhibit-read-only t))
(goto-char (point-min))
(while (not (eobp))
(cond ((re-search-forward tv-diary-done-regexp (point-at-eol) t)
(add-text-properties
(point-at-bol) (point-at-eol) '(face 'tv-org-diary-done)))
((re-search-forward tv-diary-regexp (point-at-eol) t)
(add-text-properties
(point-at-bol) (point-at-eol) '(face tv-org-diary))))
(forward-line 1)))))
(add-hook 'org-finalize-agenda-hook 'tv-org-propertize-diary-entries)
(defface tv-org-diary '((t (:foreground "Yellow3" :underline t)))
"*Face for diary entry in org agenda."
:group 'org)
(defface tv-org-diary-done '((t (:foreground "darkgrey")))
"*Face for finished diary entry in org agenda."
:group 'org)
(defun tv-org-propertize-note-entry ()
(save-excursion
(let ((inhibit-read-only t))
(goto-char (point-min))
(while (re-search-forward "^ +note" nil t)
(add-text-properties (match-beginning 0) (point-at-eol)
'(face '((:foreground "magenta"))))))))
(add-hook 'org-finalize-agenda-hook 'tv-org-propertize-note-entry)
(set-face-attribute 'org-agenda-date-weekend nil :foreground "red")
;; org-crypt
(require 'org-crypt)
(org-crypt-use-before-save-magic)
(setq org-crypt-key "59F29997")
(setq org-crypt-disable-auto-save t) ;'encrypt)
(define-key org-mode-map (kbd "C-c e") 'org-encrypt-entry)
(define-key org-mode-map (kbd "C-c d") 'org-decrypt-entry)
;; fontify source code
(setq org-src-fontify-natively t)
;; Always show full path of files
(setq org-link-file-path-type 'absolute)
;; Org babel
(require 'ob-sh)
(require 'ob-emacs-lisp)
(provide 'org-config-thierry)
;;; org-config-thierry.el ends here