From 3b33def9501783d8a891c9b0f23f619a9f67c42b Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Sun, 14 Nov 2021 20:42:15 -0800 Subject: [PATCH] Integrating org-super-agenda to supe-up my agenda display This makes it easier to see what is going on. --- README.org | 1 + bootstrap.org | 2 +- ha-agendas.org | 171 +++++++++++++++++++++++++++++++++++++++++++++++++ ha-org.org | 8 +-- 4 files changed, 177 insertions(+), 5 deletions(-) create mode 100644 ha-agendas.org diff --git a/README.org b/README.org index 70c8f78..dc15a63 100644 --- a/README.org +++ b/README.org @@ -24,6 +24,7 @@ This creates [[file:~/.emacs.d/init.el][~/.emacs.d/init.el]] that starts the pro - [[file:ha-remoting.org][ha-remoting.org]] :: my interface to systems using SSH and Vterm. - [[file:ha-feed-reader.org][ha-feed-reader.org]] :: configuration of elfeed as well as my RSS feeds. - [[file:ha-capturing-notes.org][ha-capturing-notes.org]] :: my engineering notebook. + - [[file:ha-agendas.org][ha-agendas.org]] :: Attempts to "supe-up" my task list. - [[file:ha-programming.org][ha-programming.org]] :: configuration for /all/ programming languages, or at least, the simple ones. *Note:* Other functions and files come from essays written on [[http://www.howardism.org][my blog]]. To help with this, see [[file:support/final-initialize.el][support/final-initialize.el]] file. diff --git a/bootstrap.org b/bootstrap.org index f3caebd..81bcc43 100644 --- a/bootstrap.org +++ b/bootstrap.org @@ -120,7 +120,7 @@ The following loads the rest of my org-mode literate files. I add them as they a "ha-org-sprint.org" "ha-capturing-notes.org" "ha-programming.org" - ;; "ha-agendas.org" + "ha-agendas.org" ;; "ha-email.org" ;; "ha-irc.org" ;; "ha-passwords.org" diff --git a/ha-agendas.org b/ha-agendas.org new file mode 100644 index 0000000..1768149 --- /dev/null +++ b/ha-agendas.org @@ -0,0 +1,171 @@ +#+TITLE: Org Agenda Configuration +#+AUTHOR: Howard X. Abrams +#+EMAIL: howard.abrams@gmail.com +#+DATE: 2020-09-18 +#+FILETAGS: :emacs: + +A literate programming configuration for fancy agenda and todo lists. + +#+BEGIN_SRC emacs-lisp :exports none +;;; ha-agendas.el --- A literate programming configuration for fancy agenda and todo lists. -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2020 Howard X. Abrams +;; +;; Author: Howard X. Abrams +;; Maintainer: Howard X. Abrams +;; Created: September 18, 2020 +;; +;; This file is not part of GNU Emacs. +;; +;; *NB:* Do not edit this file. Instead, edit the original literate file at: +;; ~/other/hamacs/ha-agendas.org +;; And tangle the file to recreate this one. +;; +;;; Code: +#+END_SRC +* Introduction +All the code we describe in this file needs loading /after/ org. + +#+BEGIN_SRC emacs-lisp +(with-eval-after-load "org" + (add-to-list 'org-modules 'org-protocol)) +#+END_SRC +* Grouping +Typical agendas have an /order/ to them, but the [[https://github.com/alphapapa/org-super-agenda][org-super-agenda project]] allows you to get specific as well as group them under headings. + +Unless you specify otherwise, this is the grouping we'll use: + +#+BEGIN_SRC emacs-lisp + (use-package org-super-agenda + :after org + :init + (setq org-super-agenda-date-format "%A (%e)" + org-super-agenda-groups + '((:name "Accomplishments" + :todo ("DONE" "CANCELED") + :order 4) + (:name "End of Day" + :habit t + :order 2) + (:name "Uncompleted Work" + :todo "DOING" + :scheduled past + :order 0) + (:name "Today's Tasks" + :date today + :order 1) + (:name "Today's Tasks" + :scheduled today + :order 1) + (:name "Future Work" + :todo "TODO" + :scheduled future + :order 3)))) +#+END_SRC + +The task matches a group based on the /code order/, but the =:order= tag allows me to display them in a different order. + +The following super agenda is just for /today/ and should be smaller: +#+BEGIN_SRC emacs-lisp :tangle no + (setq ha-org-super-agenda-today + '((:name "Finished" + :todo ("DONE" "CANCELED") + :order 4) + (:name "End of Day" + :habit t + :order 2) + (:name "Today's Tasks" + :todo "DOING" + :scheduled past + :date today + :order 0))) +#+END_SRC +* Query Views +The [[https://github.com/alphapapa/org-ql][org-ql project]] gives us a /query language/ of sorts (based on s-expressions). + +By putting all queries under =org-ql-views=, we can then call ~M-x query~ and select the view to display: + +#+BEGIN_SRC emacs-lisp + (use-package org-ql + :after org + :config + ;; Often used 'subgroup' that defines a work task + (setq ha-org-ql-typical-work-tasks + '(and (tags "work") + + ;; I will always be Supporting the onboarding projects, + ;; but don't show them (but show descendants): + (not (and (tags "onboarding") + (heading "^Support "))) + + ;; Show a blocking subtask instead of the parent: + (or (not (children)) + (not (descendants (todo "TODO" "DOING")))) + + (not (habit)) + (not (done)))) + + (setq org-ql-views + (list (cons "Overview: Today" + (list :buffers-files #'org-agenda-files + :query `(or (closed :on today) + (and (habit) + (not (done)) + (scheduled :to today)) + (and ,ha-org-ql-typical-work-tasks + (or (deadline auto) + (todo "DOING") + (scheduled :to today) + (ts-active :on today)))) + :sort '(priority date) + :super-groups 'ha-org-super-agenda-today + :title "Today in Me")) + + (cons "Overview: Tomorrow" + (list :buffers-files #'org-agenda-files + :query '(and (not (done)) + (tags "work") + (scheduled :from tomorrow :to tomorrow)) + :sort '(priority date) + :super-groups 'ha-org-super-agenda-today + :title "Overview: Tomorrow's tasks")) + + (cons "Calendar: Today" + (list :buffers-files #'org-agenda-files + :query '(ts-active :on today) + :title "Today" + :super-groups 'ha-org-super-agenda-today + :sort '(priority)))))) +#+END_SRC +* Agenda Interface +We can create a function to start this: +#+BEGIN_SRC emacs-lisp +(defun ha-todays-agenda () + "Display an agenda for today, including tasks and scheduled entries." + (interactive) + (org-ql-view "Overview: Today")) +#+END_SRC + +And of course, a keybinding: +#+BEGIN_SRC emacs-lisp +(ha-leader "a a" '("my agenda" . ha-todays-agenda)) +#+END_SRC +* Technical Artifacts :noexport: +Let's provide a name so that the file can be required: + +#+BEGIN_SRC emacs-lisp :exports none +(provide 'ha-agendas) +;;; ha-agendas.el ends here +#+END_SRC + +Before you can build this on a new system, make sure that you put the cursor over any of these properties, and hit: ~C-c C-c~ + +#+DESCRIPTION: A literate programming configuration for fancy agenda and todo lists. + +#+PROPERTY: header-args:sh :tangle no +#+PROPERTY: header-args:emacs-lisp :tangle yes +#+PROPERTY: header-args :results none :eval no-export :comments no mkdirp yes + +#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil date:nil +#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil +#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js diff --git a/ha-org.org b/ha-org.org index adbe237..c10b20f 100644 --- a/ha-org.org +++ b/ha-org.org @@ -297,15 +297,15 @@ Bindings specific to org files: #+BEGIN_SRC emacs-lisp (general-evil-define-key 'normal org-mode-map :prefix "SPC m" - "e" '("exports" . org-export-dispatch) + "e" '("exports" . org-export-dispatch) "l" '("insert link" . org-insert-link) - "o" '("goto link" . ace-link-org) + "o" '("goto link" . ace-link-org) "n" '(:ignore t :which-key "narrow") "n s" '("subtree" . org-narrow-to-subtree) - "n b" '("block" . org-narrow-to-block) + "n b" '("block" . org-narrow-to-block) "n e" '("element" . org-narrow-to-element) - "n w" '("widen" . widen)) + "n w" '("widen" . widen)) #+END_SRC Oh, and we'll use [[https://github.com/abo-abo/ace-link][ace-link]] for quickly jumping: #+BEGIN_SRC emacs-lisp