diff options
author | Bobby Bingham <koorogi@koorogi.info> | 2020-04-24 17:52:31 -0500 |
---|---|---|
committer | Bobby Bingham <koorogi@koorogi.info> | 2021-02-06 10:39:37 -0600 |
commit | b01a8d2f53743ad21d6ba8ae6364a81045b643d8 (patch) | |
tree | 0c641eaae59f1fa2a5bde7869baa431bdcf2c371 | |
parent | 9c86c41ff85b55b29e1ac613080069b6fe03da4a (diff) |
emacs: switch to org-ql
-rw-r--r-- | emacs/.emacs.d/init.el | 8 | ||||
-rw-r--r-- | emacs/.emacs.d/org-mode.el | 88 |
2 files changed, 69 insertions, 27 deletions
diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 8b63995..cfbc5a2 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -45,17 +45,17 @@ (ivy-mode 1)) ;; --- ORG MODE --- -(use-package org +(use-package org-ql + :demand t :mode (("\\.org$" . org-mode)) :init (add-to-list 'auto-mode-alist `(,(expand-file-name "~/org/") . org-mode)) :bind - (("C-c a" . org-agenda)) + (("C-c a" . bab/org-agenda)) :config (load-file "~/.emacs.d/org-mode.el") - (load-if-exists "~/.emacs.d/org-mode.local.el") - ) + (load-if-exists "~/.emacs.d/org-mode.local.el")) ;; --- PROJECTS --- (use-package projectile diff --git a/emacs/.emacs.d/org-mode.el b/emacs/.emacs.d/org-mode.el index 45af255..0619177 100644 --- a/emacs/.emacs.d/org-mode.el +++ b/emacs/.emacs.d/org-mode.el @@ -1,38 +1,77 @@ ;; --- CUSTOM DEFINITIONS AND FUNCTIONS --- (setq ;; list of TODO statuses that are actionable - bab/org/todos-actionable '("TODO" "IN-PROGRESS") + bab/org-todos-actionable '("TODO" "IN-PROGRESS") ) -(defun bab/org/get-todo (entry) +(defun bab/org-get-todo (entry) (org-entry-get (get-text-property 0 'org-marker entry) "TODO" nil)) -(defun bab/org/todo-is-actionable (todo) - (if (member todo bab/org/todos-actionable) t nil)) +(defun bab/org-todo-actionable-p (todo) + (if (member todo bab/org-todos-actionable) t nil)) -(defun bab/org/todo-is-not-actionable (todo) - (not (bab/org/todo-is-actionable todo))) +(defun bab/org-entry-actionable-p (entry) + (bab/org-todo-actionable-p (bab/org-get-todo entry))) -(defun bab/org/cmp-actionable (a b) - (let* ((a-is-actionable (bab/org/todo-is-actionable (bab/org/get-todo a))) - (b-is-actionable (bab/org/todo-is-actionable (bab/org/get-todo b)))) - (if (equal a-is-actionable b-is-actionable) nil (if a-is-actionable -1 1)))) +(defun bab/org-cmp-actionable (a b) + (if (bab/org-entry-actionable-p a) nil t)) -;; --- CONFIGURATION --- -(setq - org-capture-templates () - ) +(defun bab/org-agenda () + "My own custom org agenda" + (interactive) + (org-ql-search (org-agenda-files) + '(and + (todo) + (not (done)) ;; maybe allow entries that were completed today? + (not (org-entry-blocked-p)) + (or + (deadline auto) ;; deadline near enough to care about + (not (deadline)) ;; or no deadline at all + (scheduled :to today) + (ts-active :on today))) + :title "My Agenda" + :sort '(priority deadline) + :super-groups + '((:name "Scheduled Later" + :scheduled future + :order 8) + (:name "Overdue" + :deadline past) + (:name "Today" + :deadline today + :scheduled past + :scheduled today) + (:name "Some Day" + :deadline nil + :order 9) + (:name "Waiting" + :pred (lambda (entry) (not (bab/org-entry-actionable-p entry))) + :order 8) + (:name "Upcoming" + :anything t) + ))) -(define-key global-map "\C-cc" 'org-capture) +(defun bab/org-agenda-test () + "My own custom org agenda" + (interactive) + (org-ql-search (org-agenda-files) + '(and + (not (done)) ;; maybe allow entries that were completed today? + (not (org-entry-blocked-p)) + (or + (deadline auto) ;; deadline near enough to care about + (not (deadline)) ;; or no deadline at all + (scheduled :to today) + (ts-active :on today))) + :title "My Agenda - TEST" + :sort '(priority deadline) + :super-groups + '((:name "FIRST" + :deadline past + :deadline today)))) -(setq org-agenda-custom-commands - '(("a" "Agenda" - ((agenda "" - ((org-agenda-cmp-user-defined 'bab/org/cmp-actionable) - (org-agenda-sorting-strategy '(time-up scheduled-down user-defined-up priority-down deadline-up)))) - (alltodo "" - ((org-agenda-skip-function '(org-agenda-skip-if nil '(scheduled deadline))) - (org-agenda-overriding-header "Some day:"))))))) +;; --- CONFIGURATION --- +(define-key global-map "\C-cc" 'org-capture) (setq ;; Use priorities A-E, default priority is C @@ -49,6 +88,9 @@ ("IN-PROGRESS" . "magenta1") ("CANCELED" . (:foreground "snow4"))) + ;; Blank capture templates, so local config can add to it + org-capture-templates () + ;; Agenda org-agenda-files '("~/org/agenda") org-agenda-overriding-columns-format "%1PRIORITY %DEADLINE %TODO %CLOCKSUM %80ITEM" |