1
0
Fork 0

Move org-agenda settings to their own section

This commit is contained in:
Tom Willemse 2020-09-21 18:23:04 -07:00
parent 9823773eef
commit 2eb1766496

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; Version: 2020.0921.181052
;; Version: 2020.0921.182344
;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org-plus-contrib org-bullets org-edna diminish all-the-icons)
;; This program is free software; you can redistribute it and/or modify
@ -138,27 +138,6 @@ After running it once remove it from `org-capture-after-finalize-hook'."
(setq org-tag-faces (oni-org-generate-tag-faces))
(org-set-tag-faces 'org-tag-faces org-tag-faces))
(defun oni-org-set-agenda-category-icons ()
"Set org-agenda-category-icon-alist."
(let* ((icon-height (window-default-font-height))
(defaults `(png nil :height ,icon-height :ascent center)))
(setq org-agenda-category-icon-alist
`((,(rx string-start "task" string-end) ,(expand-file-name "icons8-checkmark-64.png" oni-org-icons-dir) ,@defaults)
(,(rx string-start "inbox" string-end) ,(expand-file-name "icons8-inbox-64.png" oni-org-icons-dir) ,@defaults)
(,(rx string-start "email" string-end) ,(expand-file-name "icons8-email-64.png" oni-org-icons-dir) ,@defaults)
(,(rx string-start "life" string-end) ,(expand-file-name "icons8-sprout-64.png" oni-org-icons-dir) ,@defaults)
(,(rx string-start "feature" string-end) ,(expand-file-name "icons8-code-64.png" oni-org-icons-dir) ,@defaults)
(,(rx string-start "work" string-end) ,(expand-file-name "icons8-workstation-64.png" oni-org-icons-dir) ,@defaults)
(,(rx string-start "game" string-end) ,(expand-file-name "icons8-game-controller-64.png" oni-org-icons-dir) ,@defaults)
(,(rx string-start "shopping" string-end) ,(expand-file-name "icons8-shopping-cart-64.png" oni-org-icons-dir) ,@defaults)
(,(rx string-start "bug" string-end) ,(expand-file-name "icons8-bug-64.png" oni-org-icons-dir) ,@defaults)
(,(rx string-start "idea" string-end) ,(expand-file-name "icons8-light-64.png" oni-org-icons-dir) ,@defaults)))))
(defun oni-org-initialize-agenda-category-icons ()
"Set org-agenda-category-icon-alist if it hasnt already been set."
(when (null org-agenda-category-icon-alist)
(oni-org-set-agenda-category-icons)))
;;;###autoload(autoload 'oni-hydra-org/body "oni-org")
(defhydra oni-hydra-org (:color teal :hint nil)
"
@ -205,8 +184,6 @@ _l_: Store link ^^ _j_: Journal entry
(defalias 'org-dblock-write:oni-backlinks 'oni-org-dblock-write-backlinks)
(setq org-agenda-tags-todo-honor-ignore-options t)
(setq org-agenda-todo-ignore-scheduled 'future)
(setq org-catch-invisible-edits 'error)
(setq org-clock-in-switch-to-state #'oni-org-maybe-change-todo-state)
(setq org-fontify-whole-heading-line t)
@ -220,29 +197,13 @@ _l_: Store link ^^ _j_: Journal entry
(setq org-src-fontify-natively t)
(setq org-use-fast-todo-selection t)
;;; Set the maximum indentation level for description lists to 5 (which is the
;;; seemingly hardcoded value of the indentation it gets when it goes over
;;; org-list-description-max-indent) so that I dont get dangling descriptions
;;; when my term is 19 characters long.
;; Set the maximum indentation level for description lists to 5 (which is the
;; seemingly hardcoded value of the indentation it gets when it goes over
;; org-list-description-max-indent) so that I dont get dangling descriptions
;; when my term is 19 characters long.
(setq org-list-description-max-indent 5)
(setq org-agenda-custom-commands
'(("i" "Inbox" tags "CATEGORY=\"inbox\"")
("t" "Next" tags-todo "TODO=\"NEXT\"-CATEGORY=\"inbox\"")
("s" "Someday" tags-todo "TODO=\"TODO\"-CATEGORY=\"inbox\"")
("p" "Projects & ideas" tags "CATEGORY=\"project\"|CATEGORY=\"idea\"")
("c" "Today's (Current) tasks" tags "SCHEDULED=\"<today>\"")
("w" . "Work topics")
("wo" "Overview" ((tags-todo "+work-remy-mia")
(tags-todo "+work+idea+mia")
(tags-todo "+work+idea+remy")))
("wt" "Word todo" tags-todo "+work-remy-mia")
("wm" "Topics for Mia" tags-todo "+work+idea+mia")
("wr" "Topics for Remy" tags-todo "+work+idea+remy")
("S" "Shopping" tags-todo "+shopping")))
(setq org-default-notes-file "~/documents/gtd/everything.org")
(setq org-agenda-files (list org-default-notes-file))
(defun oni-org-find-heading-in-file (heading file &optional move)
"Try to find HEADING somewhere in FILE.
@ -352,7 +313,6 @@ also move point to the start of the heading."
(add-to-list 'org-babel-load-languages '(java . t))
(add-hook 'org-mode-hook #'oni-org-initialize-agenda-category-icons)
(add-hook 'org-mode-hook #'oni-org-set-tag-faces)
(add-hook 'org-mode-hook #'oni-org-set-todo-keyword-faces)
(add-hook 'org-mode-hook 'flyspell-mode)
@ -381,5 +341,50 @@ also move point to the start of the heading."
;;;###autoload(with-eval-after-load 'org (require 'oni-org))
;;;; Agenda
(defun oni-org-initialize-agenda-category-icons ()
"Set org-agenda-category-icon-alist if it hasnt already been set."
(when (null org-agenda-category-icon-alist)
(oni-org-set-agenda-category-icons)))
(defun oni-org-set-agenda-category-icons ()
"Set org-agenda-category-icon-alist."
(let* ((icon-height (window-default-font-height))
(defaults `(png nil :height ,icon-height :ascent center)))
(setq org-agenda-category-icon-alist
`((,(rx string-start "task" string-end) ,(expand-file-name "icons8-checkmark-64.png" oni-org-icons-dir) ,@defaults)
(,(rx string-start "inbox" string-end) ,(expand-file-name "icons8-inbox-64.png" oni-org-icons-dir) ,@defaults)
(,(rx string-start "email" string-end) ,(expand-file-name "icons8-email-64.png" oni-org-icons-dir) ,@defaults)
(,(rx string-start "life" string-end) ,(expand-file-name "icons8-sprout-64.png" oni-org-icons-dir) ,@defaults)
(,(rx string-start "feature" string-end) ,(expand-file-name "icons8-code-64.png" oni-org-icons-dir) ,@defaults)
(,(rx string-start "work" string-end) ,(expand-file-name "icons8-workstation-64.png" oni-org-icons-dir) ,@defaults)
(,(rx string-start "game" string-end) ,(expand-file-name "icons8-game-controller-64.png" oni-org-icons-dir) ,@defaults)
(,(rx string-start "shopping" string-end) ,(expand-file-name "icons8-shopping-cart-64.png" oni-org-icons-dir) ,@defaults)
(,(rx string-start "bug" string-end) ,(expand-file-name "icons8-bug-64.png" oni-org-icons-dir) ,@defaults)
(,(rx string-start "idea" string-end) ,(expand-file-name "icons8-light-64.png" oni-org-icons-dir) ,@defaults)))))
(setq org-agenda-files (list org-default-notes-file))
(setq org-agenda-tags-todo-honor-ignore-options t)
(setq org-agenda-todo-ignore-scheduled 'future)
(setq org-agenda-custom-commands
'(("i" "Inbox" tags "CATEGORY=\"inbox\"")
("t" "Next" tags-todo "TODO=\"NEXT\"-CATEGORY=\"inbox\"")
("s" "Someday" tags-todo "TODO=\"TODO\"-CATEGORY=\"inbox\"")
("p" "Projects & ideas" tags "CATEGORY=\"project\"|CATEGORY=\"idea\"")
("c" "Today's (Current) tasks" tags "SCHEDULED=\"<today>\"")
("w" . "Work topics")
("wo" "Overview" ((tags-todo "+work-remy-mia")
(tags-todo "+work+idea+mia")
(tags-todo "+work+idea+remy")))
("wt" "Word todo" tags-todo "+work-remy-mia")
("wm" "Topics for Mia" tags-todo "+work+idea+mia")
("wr" "Topics for Remy" tags-todo "+work+idea+remy")
("S" "Shopping" tags-todo "+shopping")))
(add-hook 'org-mode-hook #'oni-org-initialize-agenda-category-icons)
(provide 'oni-org)
;;; oni-org.el ends here