aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d
diff options
context:
space:
mode:
Diffstat (limited to '.emacs.d')
-rw-r--r--.emacs.d/lisp/init-org.el361
1 files changed, 184 insertions, 177 deletions
diff --git a/.emacs.d/lisp/init-org.el b/.emacs.d/lisp/init-org.el
index 1840d7d..70ab76d 100644
--- a/.emacs.d/lisp/init-org.el
+++ b/.emacs.d/lisp/init-org.el
@@ -1,28 +1,34 @@
-(use-package org
- :ensure t
- :after evil
- :commands (org-mode org-agenda org-store-link org-capture)
- :mode (("\\.org$" . org-mode))
- :hook ((org-mode . (lambda () (setq tab-width 4))))
- :init
- (setq org-src-tab-acts-natively t)
+(use-package org-ql :ensure t :defer t)
+
+(defvar gx/org-agenda-block--today-schedule
+ '(agenda "" ((org-agenda-span 1)
+ (org-agenda-overriding-header "Today's Schedule")))
+ "A block showing today's schedule.")
+
+(defvar gx/org-agenda-block--weekly-schedule
+ '(agenda "" ((org-agenda-overriding-header "Weekly Schedule")
+ (org-agenda-ndays-to-span 7)))
+ "A block showing weekly schedule.")
+
+(defvar gx/org-agenda-block--stuck-projects
+ '(org-ql-block '(and (tags "PROJECT")
+ (not (or (done) (todo "SOMEDAY")))
+ (not (descendants (todo "NEXT")))
+ (not (descendants (scheduled))))
+ ((org-ql-block-header "Stuck Projects")))
+ "A block showing stuck projects.")
+
+(autoload 'org-mode "org")
+(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
+
+;; keybinds
+(with-eval-after-load 'evil
(evil-define-key 'normal 'global
(kbd "<leader>a") 'org-agenda
(kbd "<leader>l") 'org-store-link
- (kbd "<leader>co") 'org-capture)
- :config
- (require 'org-tempo)
- (setq org-default-notes-file "~/words/journals/inbox.org")
- (setq org-capture-templates
- '(("t" "TODO" entry (file+headline org-default-notes-file "Tasks")
- "* TODO %?\nCaptured on %U\n %i\n %a")
- ("j" "Journal" entry (file+datetree org-default-notes-file)
- "* %?\nCaptured on %U\n %i\n %a")))
- (add-hook 'org-mode-hook (lambda () (setq truncate-lines nil)))
- (setq org-agenda-start-on-weekday 0)
- (setq org-adapt-indentation nil)
- (setq org-startup-indented t)
- (setq org-descriptive-links t)
+ (kbd "<leader>co") 'org-capture
+ (kbd "<leader>fn") 'org-roam-node-find
+ (kbd "<leader>cn") 'org-roam-dailies-goto-today)
(evil-define-key 'normal org-mode-map
(kbd "TAB") 'org-cycle
(kbd "RET") 'org-open-at-point
@@ -37,169 +43,170 @@
(kbd "<leader>ocr") 'org-clock-report
(kbd "<leader>sp") 'org-set-property
(kbd "+") 'org-priority-up
- (kbd "-") 'org-priority-down)
- (setq org-tags-exclude-from-inheritance
- '("PROJECT"))
-
- (setq org-clock-persist 'history)
- (org-clock-persistence-insinuate)
- (setq org-tags-column (- fill-column))
-
- ;; refile
- (setq org-refile-targets '((nil :maxlevel . 9)
- (org-agenda-files :maxlevel . 9))
- org-outline-path-complete-in-steps nil
- org-refile-use-outline-path 'file)
-
- (setq org-stuck-projects
- '("+PROJECT/-SOMEDAY-DONE-MAYBE" ("NEXT") ("@shop")
- "\\<IGNORE\\>"))
-
- ;; todo
- (setq org-todo-keywords
- '((sequence "TODO(t)" ; to do later
- "NEXT(n)" ; doing now or to do soon
- "WAITING(w)" "SOMEDAY(s)"
- "|" "DONE(d)" "CANCELLED(c)")))
- (setq org-log-done t)
-
- ;; tags
- (setq org-tag-alist '((:startgroup . nil)
- ("@work" . ?w) ("@home" . ?h) ("errants" . ?e)
- (:endgroup . nil)
- ("phone" . ?m)
- ("FLAGGED" . ?f)
- ("URGENT" . ?u)
- ("PROJECT" . ?p)))
-
- ;; org babel
+ (kbd "-") 'org-priority-down
+ (kbd "<leader>oin") 'org-roam-node-insert))
+
+(add-hook 'org-mode-hook
+ (lambda ()
+ (setq truncate-lines nil)
+ (setq tab-width 4)))
+
+(setq org-default-notes-file "~/words/journals/inbox.org")
+(setq org-agenda-start-on-weekday 0)
+(setq org-tags-exclude-from-inheritance
+ '("PROJECT"))
+(setq org-stuck-projects
+ '("+PROJECT/-SOMEDAY-DONE-MAYBE" ("NEXT") ("@shop")
+ "\\<IGNORE\\>"))
+
+;; appearance
+(setq org-src-tab-acts-natively t)
+(setq org-adapt-indentation nil)
+(setq org-startup-indented t)
+(setq org-descriptive-links t)
+(setq org-tags-column (- fill-column))
+(setq org-agenda-tags-column org-tags-column)
+
+;; todo
+(setq org-todo-keywords
+ '((sequence "TODO(t)" ; to do later
+ "NEXT(n)" ; doing now or to do soon
+ "WAITING(w)" "SOMEDAY(s)"
+ "|" "DONE(d)" "CANCELLED(c)")))
+(setq org-log-done t)
+
+;; tags
+(setq org-tag-alist '((:startgroup . nil)
+ ("@work" . ?w) ("@home" . ?h) ("errants" . ?e)
+ (:endgroup . nil)
+ ("phone" . ?m)
+ ("FLAGGED" . ?f)
+ ("URGENT" . ?u)
+ ("PROJECT" . ?p)))
+
+;; refile
+(setq org-refile-targets '((nil :maxlevel . 9)
+ (org-agenda-files :maxlevel . 9))
+ org-outline-path-complete-in-steps nil
+ org-refile-use-outline-path 'file)
+
+;; capture
+(setq org-capture-templates
+ '(("t" "TODO" entry (file+headline org-default-notes-file "Tasks")
+ "* TODO %?\nCaptured on %U\n %i\n %a")
+ ("j" "Journal" entry (file+datetree org-default-notes-file)
+ "* %?\nCaptured on %U\n %i\n %a")))
+
+;; clock
+(setq org-clock-persist 'history)
+(with-eval-after-load 'org
+ (org-clock-persistence-insinuate))
+
+;; modules
+(with-eval-after-load 'org
+ (add-to-list 'org-modules 'org-habit t)
+ (add-to-list 'org-modules 'org-tempo t))
+
+;; babel
+(with-eval-after-load 'org
(org-babel-do-load-languages
'org-babel-load-languages
'((shell . t)
- (plantuml . t)))
-
- ;; org-habit
- (add-to-list 'org-modules 'org-habit t))
-
-(use-package org-ql
- :ensure t
- :after (org)
- :init
- (defun my-org-agenda-block--stuck-projects (&rest args)
- "A block showing stuck projects."
- (setq org-ql-block-header "Stuck Projects")
- (org-ql-block '(and (tags "PROJECT")
- (not (or (done) (todo "SOMEDAY")))
- (not (descendants (todo "NEXT")))
- (not (descendants (scheduled)))))))
-
-(use-package org-agenda
- :ensure nil
- :after (org org-ql)
- :commands (org-agenda)
- :init
- (setq org-agenda-dim-blocked-tasks nil)
- (setq org-agenda-skip-deadline-prewarning-if-scheduled t)
- ;; (setq org-agenda-prefix-format
- ;; '((agenda . "%i %-12:c%?-12t% s %b")
- ;; (timeline . " % s")
- ;; (todo . "%i %-12:c %b")
- ;; (tags . "%i %-12:c")
- ;; (search . " %i %-12:c")))
-
- (setq org-agenda-tags-column org-tags-column)
- (setq org-deadline-warning-days 30)
- (setq org-agenda-compact-blocks t)
-
- (setq org-agenda-custom-commands
- '(("D" "Daily agenda and all TODOs"
- ((agenda "" ((org-agenda-span 1)))
- (tags-todo "+PRIORITY=\"A\"")
- (tags-todo "computer|@office|phone")
- (tags "PROJECT+CATEGORY=\"elephants\"")
- (my-org-agenda-block--stuck-projects)
- (todo "NEXT")
- (todo "WAITING"))
- ((org-agenda-compact-blocks t)))
- ("W" "Weekly Review"
- ((agenda "" ((org-agenda-ndays-to-span 7)))
- (my-org-agenda-block--stuck-projects)
- (todo "NEXT")
- (todo "WAITING")))
- ("d" "Upcoming deadlines" agenda ""
- ((org-agenda-time-grid nil)
- (org-deadline-warning-days 365)
- (org-agenda-entry-types '(:deadline))))
- ("c" "Weekly schedule" agenda ""
- ((org-agenda-span 7)
- (org-agenda-repeating-timestamp-show-all t)
- (org-agenda-entry-types '(:deadline :scheduled))))
- ("g" . "GTD contexts")
- ("gh" "Home" tags-todo "home")
- ("p" . "Priorities")
- ("pa" "A items" tags-todo "+PRIORITIES=\"A\"")
- ("pb" "B items" tags-todo "+PRIORITIES=\"B\"")
- ("pc" "C items" tags-todo "+PRIORITIES=\"C\""))))
-
-(use-package evil-org
- :ensure t
- :after (org evil)
- :hook (org-mode . (lambda () (evil-org-mode)))
- :config
- (evil-org-set-key-theme '(navigation insert textobjects additional calendar todo))
- (require 'evil-org-agenda)
- (evil-org-agenda-set-keys)
+ (plantuml . t))))
+
+;; agenda
+(setq org-agenda-dim-blocked-tasks nil)
+(setq org-agenda-skip-deadline-prewarning-if-scheduled t)
+(setq org-deadline-warning-days 30)
+;; (setq org-agenda-prefix-format
+;; '((agenda . "%i %-12:c%?-12t% s %b")
+;; (timeline . " % s")
+;; (todo . "%i %-12:c %b")
+;; (tags . "%i %-12:c")
+;; (search . " %i %-12:c")))
+(setq org-agenda-custom-commands
+ `(("D" "Daily agenda and all TODOs"
+ (,gx/org-agenda-block--today-schedule
+ (tags-todo "+PRIORITY=\"A\"")
+ (tags-todo "computer|@office|phone")
+ (tags "PROJECT+CATEGORY=\"elephants\"")
+ ,gx/org-agenda-block--stuck-projects
+ (todo "NEXT")
+ (todo "WAITING")))
+ ("W" "Weekly Review"
+ (,gx/org-agenda-block--weekly-schedule
+ ,gx/org-agenda-block--stuck-projects
+ (todo "NEXT")
+ (todo "WAITING")))
+ ("d" "Upcoming deadlines" agenda ""
+ ((org-agenda-time-grid nil)
+ (org-deadline-warning-days 365)
+ (org-agenda-entry-types '(:deadline))))
+ ("c" "Weekly schedule" agenda ""
+ ((org-agenda-span 7)
+ (org-agenda-repeating-timestamp-show-all t)
+ (org-agenda-entry-types '(:deadline :scheduled))))
+ ("g" . "GTD contexts")
+ ("gh" "Home" tags-todo "home")
+ ("p" . "Priorities")
+ ("pa" "A items" tags-todo "+PRIORITIES=\"A\"")
+ ("pb" "B items" tags-todo "+PRIORITIES=\"B\"")
+ ("pc" "C items" tags-todo "+PRIORITIES=\"C\"")))
+
+;; evil
+(use-package evil-org :ensure t :defer t)
+(add-hook 'org-mode-hook 'evil-org-mode)
+(with-eval-after-load 'evil
(evil-define-key 'motion org-agenda-mode-map
(kbd "q") (lambda ()
(interactive)
(org-save-all-org-buffers)
(org-agenda-quit))))
-
-(use-package org-roam
- :ensure t
- :commands (org-roam-node-find org-roam-dailies-goto-today)
- :hook (org-mode . (lambda () (org-roam-db-autosync-mode)))
- :init
- (setq org-roam-directory (file-truename "~/words"))
- (evil-define-key 'normal 'global
- (kbd "<leader>fn") 'org-roam-node-find
- (kbd "<leader>cn") 'org-roam-dailies-goto-today)
- (evil-define-key 'normal 'org-roam-mode-map
- (kbd "<leader>oin") 'org-roam-node-insert)
- :config
- (setq org-roam-db-gc-threshold most-positive-fixnum)
- (setq org-roam-dailies-directory "journals/")
- (setq org-roam-dailies-capture-templates
- '(("d" "daily" entry
- "* %?"
- :target (file+head "%<%Y/%Y-%m-%d>.org"
- "#+title: %<%a %d %b %Y>\n"))
- ("w" "weekly" entry
- "* %?"
- :target (file+head "%<%Y/week%V>.org"
- "#+title: Week %<%V %Y>\n"))
- ("m" "monthly" entry
- "* %?"
- :target (file+head "%<%Y/%Y-%m>.org"
- "#+title: %<%B %Y>\n"))
- ("y" "yearly" entry
- "* %?"
- :target (file+head "%<%Y/%Y>.org"
- "#+title: %<%Y>\n")))))
-
-(use-package org-roam-ui
- :ensure t
- :after org-roam
- :config
- (setq org-roam-ui-follow t
- org-roam-ui-sync-theme t
- org-roam-ui-update-on-save t
- org-roam-ui-open-at-start t))
-
-(use-package org-alert
- :ensure t
- :if (daemonp)
- :init
+(with-eval-after-load 'evil-org
+ (require 'evil-org-agenda)
+ (evil-org-set-key-theme '(navigation insert textobjects additional calendar todo))
+ (evil-org-agenda-set-keys))
+
+;; roam
+(use-package org-roam :ensure t :defer t)
+(add-hook 'org-mode-hook 'org-roam-db-autosync-mode)
+(setq org-roam-directory (file-truename "~/words"))
+(setq org-roam-db-gc-threshold most-positive-fixnum)
+(setq org-roam-dailies-directory "journals/")
+(setq org-roam-dailies-capture-templates
+ '(("d" "daily" entry
+ "* %?"
+ :target (file+head "%<%Y/%Y-%m-%d>.org"
+ "#+title: %<%a %d %b %Y>\n"))
+ ("w" "weekly" entry
+ "* %?"
+ :target (file+head "%<%Y/week%V>.org"
+ "#+title: Week %<%V %Y>\n"))
+ ("m" "monthly" entry
+ "* %?"
+ :target (file+head "%<%Y/%Y-%m>.org"
+ "#+title: %<%B %Y>\n"))
+ ("y" "yearly" entry
+ "* %?"
+ :target (file+head "%<%Y/%Y>.org"
+ "#+title: %<%Y>\n"))))
+
+;; roam ui
+(use-package org-roam-ui :ensure t :defer t)
+(setq org-roam-ui-follow t
+ org-roam-ui-sync-theme t
+ org-roam-ui-update-on-save t
+ org-roam-ui-open-at-start t)
+
+;; alert
+(use-package org-alert :ensure t :defer t)
+(autoload 'org-alert-enable "org-alert")
+(when *is-a-linux*
(setq alert-default-style 'libnotify))
+(when *is-a-mac*
+ (setq alert-default-style 'osx-notifier))
+(setq org-alert-interval 60)
+(when (daemonp)
+ (org-alert-enable))
(provide 'init-org)