added a prototype agenda view with org-agenda and org-ql views

This commit is contained in:
Tyler Starr 2021-01-12 00:09:32 -08:00
parent f60c10b444
commit af645657c5
4 changed files with 263 additions and 165 deletions

View File

@ -12,10 +12,10 @@
(setq org-agenda-files (append org-capture org-agenda org-todo))
(setq org-default-notes-file org-note)
(setq org-todo-keywords
(quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
(sequence "WAITING(w@/!)" "HOLD(h@/!)" "|"
"CANCELLED(c@/!)"))))
(setq org-todo-keywords
(quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
(sequence "WAITING(w@/!)" "HOLD(h@/!)" "|"
"CANCELLED(c@/!)"))))
(setq org-tag-alist
'((:startgroup)
@ -28,87 +28,107 @@
("habit" . ?h)
("recurring" . ?r)))
(setq org-capture-todo (concat org-directory "gtd/capture/inbox.org"))
(setq org-capture-note (concat org-directory "gtd/capture/note.org"))
(setq org-capture-todo (concat org-directory "gtd/capture/inbox.org"))
(setq org-capture-note (concat org-directory "gtd/capture/note.org"))
(setq org-capture-templates
(doct '(("personal" :keys "p"
:children (("todo" :keys "t"
:file org-capture-todo
:template ("* TODO %? :@home:" "%U"))
("question" :keys "q"
:file org-capture-todo
:template ("* TODO Find out %? :question:@home:"
"%U"))
("habit" :keys "h"
:file org-capture-todo
:template ("* NEXT %? :habit:@home:" "%U"
"SCHEDULED: %(format-time-string
\"%<<%Y-%m-%d %a .+1d/3d>>\")"
":PROPERTIES:" ":STYLE: habit"
":REPEAT_TO_STATE: NEXT" ":END:"))
("meeting" :keys "m"
:children (("reoccuring" :keys "r"
:file org-capture-todo
:template ("* NEXT %? :meeting:@home:"
"%U" "SCHEDULED:
%(format-time-string
(setq org-capture-templates
(doct '(("personal" :keys "p"
:children (("todo" :keys "t"
:file org-capture-todo
:template ("* TODO %? :@home:" "%U"))
("question" :keys "q"
:file org-capture-todo
:template ("* TODO Find out %? :question:@home:"
"%U"))
("habit" :keys "h"
:file org-capture-todo
:template ("* NEXT %? :habit:@home:" "%U"
"SCHEDULED: %(format-time-string
\"%<<%Y-%m-%d %a .+1d/3d>>\")"
":PROPERTIES:" ":STYLE: habit"
":REPEAT_TO_STATE: NEXT" ":END:"))
("meeting" :keys "m"
:children (("reoccuring" :keys "r"
:file org-capture-todo
:template ("* NEXT %? :meeting:@home:"
"%U" "SCHEDULED:
%(format-time-string
\"%<<%Y-%m-%d %a +7d>>\")"
":PROPERTIES:"
":REPEAT_TO_STATE: NEXT"
":END:"))))
("note" :keys "n"
:file org-capture-note
:template ("* %? :note:@home:" "%U"))))
("work" :keys "w"
:children (("todo" :keys "t"
:file org-capture-todo
:template ("* TODO %? :@work:" "%U"))
("question" :keys "q"
:file org-capture-todo
:template ("* TODO Find out %? :question:@work:"
"%U"))
("habit" :keys "h"
:file org-capture-todo
:template ("* NEXT %? :habit:@work:" "%U"
"SCHEDULED: %(format-time-string
\"%<<%Y-%m-%d %a .+1d/3d>>\")"
":PROPERTIES:" ":STYLE: habit"
":REPEAT_TO_STATE: NEXT" ":END:"))
("meeting" :keys "m"
:children (("reoccuring" :keys "r"
:file org-capture-todo
:template ("* NEXT %? :meeting:@work:"
"%U" "SCHEDULED:
%(format-time-string
\"%<<%Y-%m-%d %a +7d>>\")"
":PROPERTIES:"
":REPEAT_TO_STATE: NEXT"
":END:"))))
("note" :keys "n"
:file org-capture-note
:template ("* %? :note:@home:" "%U"))))
("work" :keys "w"
:children (("todo" :keys "t"
:file org-capture-todo
:template ("* TODO %? :@work:" "%U"))
("question" :keys "q"
:file org-capture-todo
:template ("* TODO Find out %? :question:@work:"
"%U"))
("habit" :keys "h"
:file org-capture-todo
:template ("* NEXT %? :habit:@work:" "%U"
"SCHEDULED: %(format-time-string
\"%<<%Y-%m-%d %a .+1d/3d>>\")"
":PROPERTIES:" ":STYLE: habit"
":REPEAT_TO_STATE: NEXT" ":END:"))
("meeting" :keys "m"
:children (("reoccuring" :keys "r"
:file org-capture-todo
:template ("* NEXT %? :meeting:@work:"
"%U" "SCHEDULED:
%(format-time-string
\"%<<%Y-%m-%d %a +7d>>\")"
":PROPERTIES:"
":REPEAT_TO_STATE: NEXT"
":END:"))))
("note" :keys "n"
:file org-capture-note
:template ("* %? :note:@work:" "%U")))))))
":PROPERTIES:"
":REPEAT_TO_STATE: NEXT"
":END:"))))
("note" :keys "n"
:file org-capture-note
:template ("* %? :note:@work:" "%U")))))))
(setq org-refile-targets (quote ((nil :maxlevel . 3)
(org-agenda-files :maxlevel . 3))))
(advice-add 'org-refile :after 'org-save-all-org-buffers)
(setq org-agenda-start-day "0d")
(setq org-agenda-custom-commands
'(("t" "Agenda for today" agenda ""
((org-agenda-overriding-header "Today's agenda")
(org-agenda-span 'day)))))
(setq org-super-agenda-header-map (make-sparse-keymap))
(defun ts/org-daily-agenda ()
"launch an agenda-like view at the specified date."
(interactive)
(org-ql-search (org-agenda-files)
'(and (or (ts-active :on today)
(deadline auto)
(scheduled :to today))
(not (done)))
:title "Daily Agenda"
:super-groups '((:name "Home"
:tag "@home")
(:name "Work"
:tag "@work"))))
(setq org-ql-views
(list (cons "Week Overview"
(lambda ()
"launch an agenda-like view at the specified date."
(interactive)
(let* ((ts (ts-now))
(beg-of-week (->> ts
(ts-adjust 'day (- (ts-dow (ts-now))))
(ts-apply :hour 0 :minute 0 :second 0)))
(end-of-week (->> ts
(ts-adjust 'day (- 6 (ts-dow (ts-now))))
(ts-apply :hour 23 :minute 59 :second 59))))
(org-ql-search (org-agenda-files)
'(ts-active :from beg-of-week :to end-of-week)
:title "Week Overview"
:sort '(date priority todo)
:super-groups '((:name "Late"
:scheduled past
:deadline past)
(:name "Today"
:time-grid t
:scheduled today
:deadline today)
(:name "Coming Up"
:scheduled future
:deadline future))))))))
(after! org-agenda
(org-super-agenda-mode))) ; Close the after! org expression from

View File

@ -1,4 +1,3 @@
;;; +org.el -*- lexical-binding: t; -*-
(after! org
(setq org-directory "~/documents/org/")
)
(setq org-directory "~/documents/org/"))

View File

@ -79,6 +79,81 @@ Load modules with external configs.
(load! "+org")
(load! "+gtd")
#+end_src
* [packages.el]
#+begin_src emacs-lisp :tangle "packages.el"
;; -*- no-byte-compile: t; -*-
;;; $DOOMDIR/packages.el
;; To install a package with Doom you must declare them here and run 'doom sync'
;; on the command line, then restart Emacs for the changes to take effect -- or
;; use 'M-x doom/reload'.
;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror:
;(package! some-package)
;; To install a package directly from a remote git repo, you must specify a
;; `:recipe'. You'll find documentation on what `:recipe' accepts here:
;; https://github.com/raxod502/straight.el#the-recipe-format
;(package! another-package
; :recipe (:host github :repo "username/repo"))
;; If the package you are trying to install does not contain a PACKAGENAME.el
;; file, or is located in a subdirectory of the repo, you'll need to specify
;; `:files' in the `:recipe':
;(package! this-package
; :recipe (:host github :repo "username/repo"
; :files ("some-file.el" "src/lisp/*.el")))
;; If you'd like to disable a package included with Doom, you can do so here
;; with the `:disable' property:
;(package! builtin-package :disable t)
;; You can override the recipe of a built in package without having to specify
;; all the properties for `:recipe'. These will inherit the rest of its recipe
;; from Doom or MELPA/ELPA/Emacsmirror:
;(package! builtin-package :recipe (:nonrecursive t))
;(package! builtin-package-2 :recipe (:repo "myfork/package"))
;; Specify a `:branch' to install a package from a particular branch or tag.
;; This is required for some packages whose default branch isn't 'master' (which
;; our package manager can't deal with; see raxod502/straight.el#279)
;(package! builtin-package :recipe (:branch "develop"))
;; Use `:pin' to specify a particular commit to install.
;(package! builtin-package :pin "1a2b3c4d5e")
;; Doom's packages are pinned to a specific commit and updated from release to
;; release. The `unpin!' macro allows you to unpin single packages...
;(unpin! pinned-package)
;; ...or multiple packages
;(unpin! pinned-package another-pinned-package)
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
;(unpin! t)
(package! doct)
(package! org-ql)
(package! org-super-agenda)
(package! org-super-agenda :recipe
(:host github
:repo "starr-dusT/org-super-agenda"
:branch "master"))
(package! org-ql :recipe
(:host github
:repo "starr-dusT/org-ql"
:branch "master"))
(package! burly.el :recipe
(:host github
:repo "starr-dusT/burly.el"
:branch "master"))
#+end_src
* [init.el]
@ -269,6 +344,43 @@ Load modules with external configs.
;;literate
(default +bindings +smartparens))
#+end_src
* [+ui.el]
#+begin_src emacs-lisp :tangle (if (member this-system system-category-1) "+ui.el" "no")
;;; +ui.el -*- lexical-binding: t; -*-
;; Doom exposes five (optional) variables for controlling fonts in Doom. Here
;; are the three important ones:
;;
;; + `doom-font'
;; + `doom-variable-pitch-font'
;; + `doom-big-font' -- used for `doom-big-font-mode'; use this for
;; presentations or streaming.
;;
;; They all accept either a font-spec, font string ("Input Mono-12"), or xlfd
;; font string. You generally only need these two:
;; (setq doom-font (font-spec :family "monospace" :size 12 :weight 'semi-light)
;; doom-variable-pitch-font (font-spec :family "sans" :size 13))
;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
(setq doom-theme 'doom-gruvbox)
;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq display-line-numbers-type t)
#+end_src
* [+org.el]
#+begin_src emacs-lisp :tangle (if (member this-system system-category-1) "+org.el" "no")
;;; +org.el -*- lexical-binding: t; -*-
(after! org
(setq org-directory "~/documents/org/"))
#+end_src
* [+gtd.el]
@ -425,103 +537,65 @@ Set various refile settings. Mostly stolen from the great http://doc.norang.ca/o
(advice-add 'org-refile :after 'org-save-all-org-buffers)
#+end_src
** Super-Org-Agenda
** Agenda Views
I use the awesome [[https://github.com/alphapapa/org-super-agenda][super-org-agenda]] to setup my custom agenda views.
Currenlty I prefer to used vanilla Org-Agenda to view currently scheduled agenda items without any fancy sorting or anything like that. Following config items will utilizes the awesome [[https://github.com/alphapapa/org-ql#function-org-ql-block][org-ql]] and [[https://github.com/alphapapa/org-super-agenda][super-org-agenda]] to setup custom views with fancy sorting and insights. More details to follow!
#+begin_src emacs-lisp :tangle (if (member this-system system-category-1) "+gtd.el" "no")
; Open a view with need buffers for planning!
(defun ts/open-user-agenda ()
(interactive)
(org-agenda nil "t")
(delete-other-windows)
(get-buffer "*Org Agenda*")
(org-ql-view "Week Overview")
(org-ql-view-sidebar))
(setq org-agenda-start-day "0d")
(setq org-agenda-custom-commands
'(("t" "Agenda for today" agenda ""
((org-agenda-overriding-header "Today's agenda")
(org-agenda-span 'day)))))
#+End_src
Setup those afformentioned fancy sorting setups!
#+begin_src emacs-lisp :tangle (if (member this-system system-category-1) "+gtd.el" "no")
(setq org-super-agenda-header-map (make-sparse-keymap))
(defun ts/org-daily-agenda ()
"launch an agenda-like view at the specified date."
(interactive)
(org-ql-search (org-agenda-files)
'(and (or (ts-active :on today)
(deadline auto)
(scheduled :to today))
(not (done)))
:title "Daily Agenda"
:super-groups '((:name "Home"
:tag "@home")
(:name "Work"
:tag "@work"))))
(setq org-ql-views
(list (cons "Week Overview"
(lambda ()
"launch an agenda-like view at the specified date."
(interactive)
(let* ((ts (ts-now))
(beg-of-week (->> ts
(ts-adjust 'day (- (ts-dow (ts-now))))
(ts-apply :hour 0 :minute 0 :second 0)))
(end-of-week (->> ts
(ts-adjust 'day (- 6 (ts-dow (ts-now))))
(ts-apply :hour 23 :minute 59 :second 59))))
(org-ql-search (org-agenda-files)
'(ts-active :from beg-of-week :to end-of-week)
:title "Week Overview"
:sort '(date priority todo)
:super-groups '((:name "Late"
:scheduled past
:deadline past)
(:name "Today"
:time-grid t
:scheduled today
:deadline today)
(:name "Coming Up"
:scheduled future
:deadline future))))))))
(after! org-agenda
(org-super-agenda-mode))) ; Close the after! org expression from
; Org File Paths
#+End_src
* [packages.el]
#+begin_src emacs-lisp :tangle "packages.el"
;; -*- no-byte-compile: t; -*-
;;; $DOOMDIR/packages.el
;; To install a package with Doom you must declare them here and run 'doom sync'
;; on the command line, then restart Emacs for the changes to take effect -- or
;; use 'M-x doom/reload'.
;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror:
;(package! some-package)
;; To install a package directly from a remote git repo, you must specify a
;; `:recipe'. You'll find documentation on what `:recipe' accepts here:
;; https://github.com/raxod502/straight.el#the-recipe-format
;(package! another-package
; :recipe (:host github :repo "username/repo"))
;; If the package you are trying to install does not contain a PACKAGENAME.el
;; file, or is located in a subdirectory of the repo, you'll need to specify
;; `:files' in the `:recipe':
;(package! this-package
; :recipe (:host github :repo "username/repo"
; :files ("some-file.el" "src/lisp/*.el")))
;; If you'd like to disable a package included with Doom, you can do so here
;; with the `:disable' property:
;(package! builtin-package :disable t)
;; You can override the recipe of a built in package without having to specify
;; all the properties for `:recipe'. These will inherit the rest of its recipe
;; from Doom or MELPA/ELPA/Emacsmirror:
;(package! builtin-package :recipe (:nonrecursive t))
;(package! builtin-package-2 :recipe (:repo "myfork/package"))
;; Specify a `:branch' to install a package from a particular branch or tag.
;; This is required for some packages whose default branch isn't 'master' (which
;; our package manager can't deal with; see raxod502/straight.el#279)
;(package! builtin-package :recipe (:branch "develop"))
;; Use `:pin' to specify a particular commit to install.
;(package! builtin-package :pin "1a2b3c4d5e")
;; Doom's packages are pinned to a specific commit and updated from release to
;; release. The `unpin!' macro allows you to unpin single packages...
;(unpin! pinned-package)
;; ...or multiple packages
;(unpin! pinned-package another-pinned-package)
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
;(unpin! t)
(package! doct)
(package! org-ql)
(package! org-super-agenda)
(package! org-super-agenda :recipe
(:host github
:repo "starr-dusT/org-super-agenda"
:branch "master"))
(package! org-ql :recipe
(:host github
:repo "starr-dusT/org-ql"
:branch "master"))
#+end_src

View File

@ -62,3 +62,8 @@
(:host github
:repo "starr-dusT/org-ql"
:branch "master"))
(package! burly.el :recipe
(:host github
:repo "starr-dusT/burly.el"
:branch "master"))