Last active
April 26, 2019 10:16
-
-
Save c02y/85630314366b8b3fe7e389d7732ae844 to your computer and use it in GitHub Desktop.
org-agenda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq org-todo-keywords | |
;; !/@ meaning: https://orgmode.org/manual/Tracking-TODO-state-changes.html | |
'((sequence "TODO(t!)" "STARTED(s!)" "NEXT(n!)" "WAITING(w!)" "|" "DONE(d!)" "CANCELED(c@)") | |
;; multiple sets for one file | |
;; (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)""|" "FIXED(f)") | |
;; (sequence "|" "CANCELED(c)") | |
)) | |
# put this before txt README | |
;; set the default major-mode to org-mode instead of fundamental-mode when creating | |
;; a new buffer without an extension | |
(setq-default major-mode 'org-mode) | |
(bind-keys* | |
("C-c a a" . org-agenda) ; x to kill the buffers opened by org-agenda | |
("C-c a c" . org-capture) | |
("C-c a l" . org-store-link)) | |
(setq org-agenda-custom-commands | |
'(("c" "Simple agenda view" | |
((tags "PRIORITY=\"A\"" | |
((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done)) | |
(org-agenda-overriding-header "High-priority unfinished tasks:"))) | |
(alltodo "") | |
(agenda ""))))) | |
(setq org-capture-templates | |
'(("s" "Scheduled TODO node" entry (file "~/Org/todo.org") | |
"* TODO %?\nADDED: %U\nSCHEDULED: %t") | |
("S" "STARTED TODO node" entry (file "~/Org/todo.org") | |
"* STARTED %?\nADDED: %U" :clock-in t :clock-keep t :clock-resume t) | |
("t" "TODO list" checkitem (file "~/Org/todo.org") | |
"[ ] %?") | |
)) | |
(add-hook 'org-clock-out-hook | |
'(lambda () | |
(setq org-mode-line-string nil) | |
(force-mode-line-update))) | |
;; Resume clocking task when emacs is restarted | |
(org-clock-persistence-insinuate) | |
;; removes clocked tasks with 0:00 duration | |
(setq org-clock-out-remove-zero-time-clocks t) | |
;; Save the running clock and all clock history when exiting Emacs, load it on startup | |
(setq org-clock-persist t) | |
;; Do not prompt to resume an active clock | |
(setq org-clock-persist-query-resume nil) | |
;; Include current clocking task in clock reports | |
(setq org-clock-report-include-clocking-task t) | |
;; Overwrite the current window with the agenda | |
(setq org-agenda-window-setup 'current-window) | |
;; search all items including archives | |
(setq org-agenda-text-search-extra-files '(agenda-archives)) | |
;; mark all children DONE when mark parent DONE | |
(setq org-enforce-todo-dependencies t) | |
(setq org-log-reschedule 'time) | |
(setq org-agenda-span 15 | |
org-agenda-start-on-weekday nil | |
org-agenda-start-day "-7d") | |
;; Use specific fils as source of agenda | |
(setq org-agenda-files | |
(list "~/Org/todo.org" | |
;; "~/Org/school.org" | |
;; "~/Org/home.org" | |
)) | |
(setq org-columns-default-format "%50ITEM(Task) %TODO %3PRIORITY %TAGS %10CLOCKSUM %16TIMESTAMP_IA") | |
(setq org-log-into-drawer "LOGBOOK") | |
;; include all files in ~/Org as the source of org-agenda | |
;; (setq org-agenda-files '("~/Org/")) | |
;; from https://github.com/svetlyak40wt/dot-emacs/blob/master/.emacs.d/lib/org-auto-clock.el | |
(eval-after-load 'org | |
'(progn | |
(defun wicked/org-clock-in-if-starting () | |
"Clock in when the task is marked STARTED." | |
(when (and (string= org-state "STARTED") | |
(not (string= org-last-state org-state))) | |
(org-clock-in))) | |
(add-hook 'org-after-todo-state-change-hook 'wicked/org-clock-in-if-starting) | |
(defadvice org-clock-in (after wicked activate) | |
"Set this task's status to 'STARTED' when clock-in." | |
(org-todo "STARTED")) | |
(defun wicked/org-clock-out-if-waiting () | |
"Clock out when the task is marked WAITING or CANCELED." | |
(when (and (or (string= org-state "WAITING") | |
(string= org-state "CANCELED")) | |
(equal (marker-buffer org-clock-marker) (current-buffer)) | |
(< (point) org-clock-marker) | |
(> (save-excursion (outline-next-heading) (point)) | |
org-clock-marker) | |
(not (string= org-last-state org-state))) | |
(org-clock-out))) | |
(add-hook 'org-after-todo-state-change-hook 'wicked/org-clock-out-if-waiting))) | |
# delete the other org-store-link | |
# clean the emacs-lisp-mode-map | |
(setq-default mode-line-format | |
'( | |
"%e" | |
mode-line-front-space | |
mode-line-mule-info | |
mode-line-client | |
mode-line-modified | |
mode-line-remote | |
mode-line-frame-identification | |
mode-line-buffer-identification | |
(which-func-mode | |
("" which-func-format " ")) | |
" " mode-line-position | |
(vc-mode vc-mode) | |
(t org-mode-line-string) ;; show org info such as clock in mode line | |
" " mode-line-modes | |
"%-")) | |
# delete the org-numbers-overlay-mode part | |
;; use org-num from org-9.3(not released ye, download it from | |
;; https://raw.githubusercontent.com/bzg/org-mode/300f15bcbbaf7a49c94e2cfca4f4335f0dc55fc8/lisp/org-num.elt) | |
;; to replace org-numbers-overlay-mode which causex emacsclient fail to lanuch when using | |
;; `-e (org-capture)` or `-e (org-agenda-list)` | |
(require 'org-num) | |
;; org-sticky-header and org-table-sticky-header | |
(add-hook 'org-mode-hook | |
(lambda () | |
(org-sticky-header-mode) | |
(org-table-sticky-header-mode) | |
(org-num-mode))) | |
# After scratch line | |
;; hide the welcome/home page when startup | |
(setq inhibit-startup-screen t) | |
# comment out the following line | |
(with-eval-after-load "magit" (setq magit-git-executable "/usr/bin/git")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment