Improve org config
This commit is contained in:
parent
83895358c0
commit
d032b286a2
1 changed files with 82 additions and 2 deletions
|
@ -35,8 +35,88 @@
|
|||
;; Enable Mercurial support for git-gutter
|
||||
(setq git-gutter:handled-backends '(git hg))
|
||||
|
||||
;; Set Org directory
|
||||
(setq org-directory "~/Org")
|
||||
;; Org configuration
|
||||
(after! org
|
||||
(setq-default org-directory "~/code/personal/org")
|
||||
(setq-default org-default-notes-file "~/code/personal/org/capture.org")
|
||||
(setq-default org-todo-keywords
|
||||
(quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
|
||||
(sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" "PHONE" "MEETING"))))
|
||||
(setq-default org-todo-keyword-faces
|
||||
(quote (("TODO" :foreground "red" :weight bold)
|
||||
("NEXT" :foreground "blue" :weight bold)
|
||||
("DONE" :foreground "forest green" :weight bold)
|
||||
("WAITING" :foreground "orange" :weight bold)
|
||||
("HOLD" :foreground "magenta" :weight bold)
|
||||
("CANCELLED" :foreground "forest green" :weight bold)
|
||||
("MEETING" :foreground "forest green" :weight bold)
|
||||
("PHONE" :foreground "forest green" :weight bold))))
|
||||
(setq org-capture-templates
|
||||
(quote (("t" "todo" entry (file "~/code/personal/org/capture.org")
|
||||
"* TODO %?\n&U\n%a\n" :clock-in t :clock-resume t)
|
||||
("r" "respond" entry (file "~/code/personal/org/capture.org")
|
||||
"* STRT Respond to %:from on %:subject\nSCHEDULED: %t\n%U\n%a\n" :clock-in t :clock-resume t :immediate-finish t)
|
||||
("n" "note" entry (file "~/code/personal/org/capture.org")
|
||||
"* %? :NOTE:\n%U\n%a\n" :clock-in t :clock-resume t)
|
||||
("w" "org-protocol" entry (file "~/code/personal/org/capture.org")
|
||||
"* TODO Review %c\n%U\n" :immediate-finish t)
|
||||
("m" "meeting" entry (file "~/code/personal/org/capture.org")
|
||||
"* PROJ Meeting with %? :MEETING:\n%U" :clock-in t :clock-resume t))))
|
||||
(setq org-refile-targets (quote ((nil :maxlevel . 9)
|
||||
(org-agenda-files :maxlevel . 9))))
|
||||
(add-to-list
|
||||
'ivy-completing-read-handlers-alist
|
||||
'(org-capture-refile . completing-read-default))
|
||||
(org-clock-persistence-insinuate)
|
||||
(setq org-clock-in-switch-to-state 'cf/clock-in-to-next)
|
||||
(setq org-drawers (quote ("PROPERTIES" "LOGBOOK")))
|
||||
(setq org-clock-into-drawer t)
|
||||
(setq org-clock-out-remove-zero-time-clocks t)
|
||||
(setq org-clock-out-when-done t)
|
||||
(setq org-clock-persist t)
|
||||
(setq org-clock-auto-clock-resolution (quote when-no-clock-is-running))
|
||||
(setq org-clock-report-include-clocking-task t))
|
||||
|
||||
(defun cf/clock-in-to-next (kw)
|
||||
(when (not (and (boundp 'org-capture-mode) org-capture-mode))
|
||||
(cond
|
||||
((and (member (org-get-todo-state) (list "TODO"))
|
||||
(cf/is-task-p))
|
||||
"NEXT")
|
||||
((and (member (org-get-todo-state) (list "NEXT"))
|
||||
(cf/is-project-p))
|
||||
"TODO"))))
|
||||
|
||||
(defun cf/is-project-p ()
|
||||
(save-restriction
|
||||
(widen)
|
||||
(let ((has-subtask)
|
||||
(subtree-end (save-excursion (org-end-of-subtree t)))
|
||||
(is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1)))
|
||||
(save-excursion
|
||||
(forward-line 1)
|
||||
(while (and (not has-subtask)
|
||||
(< (point) subtree-end)
|
||||
(re-search-forward "^\*+ " subtree-end t))
|
||||
(when (member (org-get-todo-state) org-todo-keywords-1)
|
||||
(setq has-subtask t))))
|
||||
(and is-a-task has-subtask))))
|
||||
|
||||
(defun bh/is-task-p ()
|
||||
(save-restriction
|
||||
(widen)
|
||||
(let ((has-subtask)
|
||||
(subtree-end (save-excursion (org-end-of-subtree t)))
|
||||
(is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1)))
|
||||
(save-excursion
|
||||
(forward-line 1)
|
||||
(while (and (not has-subtask)
|
||||
(< (point) subtree-end)
|
||||
(re-search-forward "^\*+ " subtree-end t))
|
||||
(when (member (org-get-todo-state) org-todo-keywords-1)
|
||||
(setq has-subtask t))))
|
||||
(and is-a-task (not has-subtask)))))
|
||||
|
||||
|
||||
;; Enable editorconfig
|
||||
(editorconfig-mode 1)
|
||||
|
|
Loading…
Add table
Reference in a new issue