summary refs log tree commit diff
path: root/emacs/custom/my-org.el
blob: 77d428cdcd0836ee456aef4451cd7dc4910bae1f (plain) (blame)
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
;;; my-org.el --- Configure org-mode -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

(require 'org)
(require 'org-agenda)
(require 'org-capture)
(require 'org-archive)
(require 'ox)
(require 'ox-md)

(defvar my/org-directory
  (if (memq window-system '(mac ns))
      (expand-file-name "~/workspace/notebooks/")
    (expand-file-name "~/documents/notes/")))

(add-hook 'org-mode-hook 'org-indent-mode)
(add-hook 'org-mode-hook 'org-hide-block-all)
(add-hook 'org-mode-hook 'visual-line-mode)
(add-hook 'org-capture-after-finalize-hook 'org-save-all-org-buffers)
(add-hook 'org-capture-prepare-finalize-hook 'org-save-all-org-buffers)

(global-set-key (kbd "C-c c") 'org-capture)
(global-set-key (kbd "C-c a") 'org-agenda)

(defvar load-language-list '((emacs-lisp . t)
                             (python . t)
                             (shell . t)))

(setq org-directory my/org-directory)
(setq org-hide-emphasis-markers t)                ;; hide emphasis markup
(setq org-archive-subtree-add-inherited-tags t)   ;; when archiving, inherit the tags from the parent
(setq org-pretty-entities t)                      ;; display unicode characters
(setq org-log-done 'time)                         ;; log the time of completion
(setq org-log-into-drawer t)                      ;; insert state change in the drawer
(setq org-cycle-separator-lines 0)
(setq org-startup-folded 'content)
(setq org-todo-keywords '((sequence "TODO" "STARTED" "WAITING" "|" "DONE" "CANCELED")))

(setq org-priority-start-cycle-with-default nil) ;; Start one over/under default value.
(setq org-highest-priority ?A)
(setq org-lowest-priority ?D)
(setq org-default-priority ?C)                   ;; Ensures unset tasks have low priority.

(setq org-refile-use-cache nil)
(setq org-refile-targets `((,(expand-file-name "tasks.org" org-directory) :maxlevel . 1)
                           (,(expand-file-name "notes.org" org-directory) :maxlevel . 1)
                           (,(expand-file-name "projects.org" org-directory) :tag . "project")))
(setq org-refile-use-outline-path 'file)
(setq org-outline-path-complete-in-steps nil)
(setq org-refile-allow-creating-parent-nodes 'confirm)

;; org babel related
(setq org-src-fontify-natively t)
(setq org-src-preserve-indentation t)     ;; prevent the conversion of spaces into tabs (necessary for Python code exports)
(setq org-edit-src-content-indentation t)

(setq org-return-follows-link t)          ;; I want to follow links on RET

;; some configurations for exporting document
(setq org-export-with-toc nil)
(setq org-export-with-section-numbers nil)

;; a few abbreviations I use regularly
(setq org-link-abbrev-alist
      '(("src"  . "~/workspace/%s")
        ("jira" . "https://jira.rbx.com/browse/%s")
        ("go"   . "http://go/%s")))

(setq org-blank-before-new-entry (quote ((heading . nil) (plain-list-item . nil))))
(setq org-reverse-note-order t)

(setq org-agenda-files `(,(expand-file-name "inbox.org" org-directory)
                         ,(expand-file-name "notes.org" org-directory)
                         ,(expand-file-name "tasks.org" org-directory)
                         ,(expand-file-name "projects.org" org-directory)
                         ,(expand-file-name "bookmarks.org" org-directory)
                         ,(expand-file-name "journal.org" org-directory)))
(setq org-agenda-show-all-dates t)
(setq calendar-week-start-day 1)
(setq org-agenda-custom-commands nil)
(setq org-agenda-start-on-weekday 1)

(add-to-list 'org-agenda-custom-commands
'("A" "Agenda"
  ((agenda ""
           ((org-agenda-span 'week)))
   (todo "TODO"
         ((org-agenda-overriding-header "To Refile")
          (org-agenda-files `(,(expand-file-name "inbox.org" org-directory)))))
   (todo "STARTED"
         ((org-agenda-overriding-header "In Progress")))
   (todo "WAITING"
         ((org-agenda-overriding-header "Blocked")))
   (todo "TODO"
         ((org-agenda-overriding-header "Not yet started")
          (org-agenda-skip-function '(org-agenda-skip-entry-if 'deadline 'scheduled)))))))

(setq org-capture-templates
`(("t" "Todo" entry (file "inbox.org")
   "* TODO [#D] %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n")

  ("n" "Note" entry (file "notes.org")
   "* %?\n:PROPERTIES:\n:CREATED: %T\n:END:\n")

  ("f" "elfeed" entry (file "inbox.org")
   ,(concat "* TODO %:elfeed-entry-title\n"
            ":PROPERTIES:\n:CREATED: %T\n:END:\n"
            "%a\n"))

  ("j" "Journal" entry
   (file+olp+datetree "journal.org")
   "* %?\n:PROPERTIES:\n:CREATED: %T\n:END:\n" :tree-type day)))

(provide 'my-org)

;;; my-org.el ends here