alphapapa / org-super-agenda

Supercharge your Org daily/weekly agenda by grouping items
GNU General Public License v3.0
1.33k stars 107 forks source link
emacs org-agenda org-mode

+TITLE: org-super-agenda

+PROPERTY: LOGGING nil

+HTML:

This package lets you "supercharge" your Org daily/weekly agenda. The idea is to group items into sections, rather than having them all in one big list.

Now you can sort-of do this already with custom agenda commands, but when you do that, you lose the daily/weekly aspect of the agenda: items are no longer shown based on deadline/scheduled timestamps, but are shown no-matter-what.

So this package filters the results from ~org-agenda-finalize-entries~, which runs just before items are inserted into agenda views. It runs them through a set of filters that separate them into groups. Then the groups are inserted into the agenda buffer, and any remaining items are inserted at the end. Empty groups are not displayed.

The end result is your standard daily/weekly agenda, but arranged into groups defined by you. You might put items with certain tags in one group, habits in another group, items with certain todo keywords in another, and items with certain priorities in another. The possibilities are only limited by the grouping functions.

The primary use of this package is for the daily/weekly agenda, made by the ~org-agenda-list~ command, but it also works for other agenda views, like ~org-tags-view~, ~org-todo-list~, ~org-search-view~, etc.

Here's what a normal agenda looks like:

[[images/screenshots/screenshot-before.png]]

Here's what the "super" agenda looks like:

[[images/screenshots/screenshot-after.png]]

There are also a few [[images/screenshots/index.org][more screenshots]].

** COMMENT Tasks :noexport: :PROPERTIES: :ID: 4ff94c53-a5c3-47ec-8bcb-76909f37ca2f :END:

*** TODO Figure out how to exclude screenshots from info page but not GitHub rendering

** MELPA

Just install the =org-super-agenda= package!

** Manual installation

If you want to install manually, you must also install these packages:

Then put =org-super-agenda.el= in your =load-path=, and eval =(require 'org-super-agenda)=.

  1. Enable ~org-super-agenda-mode~.
  2. Set the variable ~org-super-agenda-groups~ as desired (see example below).

    Note: In order for groups to be automatically, persistently applied to all agenda buffers, the variable ~org-super-agenda-groups~ /must be set in the global scope/ (e.g. with ~setq~ in your init file, or using the customization interface). Alternatively, it can be ~let~-bound in lisp code that calls ~org-agenda~ commands, but in that case, the setting /will not persist across agenda commands/ (so after refreshing an agenda buffer by pressing =g=, there will be no groups).

  3. Run an Org agenda command.
  4. Start the day with confidence, knowing that nothing important has been lost in the jumble of /ahem/ overdue items.

** Examples

At first you might feel bewildered by all the options. Never fear, [[examples.org][examples]] are here!

Here's the code for the screenshots above. You can test it quickly by evaluating this code block:

+BEGIN_SRC elisp

(let ((org-super-agenda-groups '(;; Each group has an implicit boolean OR operator between its selectors. (:name "Today" ; Optionally specify section name :time-grid t ; Items that appear on the time grid :todo "TODAY") ; Items that have this TODO keyword (:name "Important" ;; Single arguments given alone :tag "bills" :priority "A") ;; Set order of multiple groups at once (:order-multi (2 (:name "Shopping in town" ;; Boolean AND group matches items that match all subgroups :and (:tag "shopping" :tag "@town")) (:name "Food-related" ;; Multiple args given in list with implicit OR :tag ("food" "dinner")) (:name "Personal" :habit t :tag "personal") (:name "Space-related (non-moon-or-planet-related)" ;; Regexps match case-insensitively on the entire entry :and (:regexp ("space" "NASA") ;; Boolean NOT also has implicit OR between selectors :not (:regexp "moon" :tag "planet"))))) ;; Groups supply their own section names when none are given (:todo "WAITING" :order 8) ; Set order of this section (:todo ("SOMEDAY" "TO-READ" "CHECK" "TO-WATCH" "WATCHING") ;; Show this group at the end of the agenda (since it has the ;; highest number). If you specified this group last, items ;; with these todo keywords that e.g. have priority A would be ;; displayed in that group instead, because items are grouped ;; out in the order the groups are listed. :order 9) (:priority<= "B" ;; Show this section after "Today" and "Important", because ;; their order is unspecified, defaulting to 0. Sections ;; are displayed lowest-number-first. :order 1) ;; After the last group, the agenda will display items that didn't ;; match any of these groups, with the default order position of 99 ))) (org-agenda nil "a"))

+END_SRC

The groups apply to all agenda commands (at least, every one that calls ~org-agenda-finalize-entries~). You can set different groups for custom commands by setting ~org-super-agenda-groups~ in the custom command's ~settings~ list (see the description for ~org-agenda-custom-commands~). You can disable grouping by binding ~org-super-agenda-groups~ to nil around a call to an agenda command, or you can disable it globally by disabling the mode.

*** COMMENT Tasks :noexport:

**** TODO Export examples to info page

** Group selectors

Each group selector creates a group in the agenda containing the items it matches and consumes those items; any items it doesn't match are passed to the next group selector. The selector ~:discard~ is an exception: it consumes any items it matches without creating an agenda group and passes through the rest to the next selector.

Each group selector takes an argument which can be a single atom or a list, e.g. ~:tag~ takes a string or list of strings. Some selectors are predicates, like ~:deadline~ or ~:habit~; for consistency, they also take an argument, but it is ignored.

Note: The order of items may not be preserved after grouping due to the implementation's using hash tables. Future versions may address this shortcoming.

*** Keywords

*** Special selectors

Every selector requires an argument, even if it's just ~t~, e.g. ~:anything~, ~:auto-category~, ~:auto-group~, and ~:discard~.

*** Normal selectors

These selectors take one argument alone, or multiple arguments in a list.

** Tips

** Why are some items not displayed even though I used group selectors for them?

This is a common misunderstanding of how this package works. As written in the introduction, it does not /collect/ items. It only /groups/ items that are collected by Org Agenda or =org-ql=. So if your Agenda command or =org-ql= query does not collect certain items, they will not be displayed, regardless of what =org-super-agenda= groups you configure.

[[https://github.com/alphapapa/org-ql][org-ql]] provides an easier way to write queries to generate agenda-like views that can be grouped with =org-super-agenda=.

** Why did a group disappear when I moved it to the end of the list?

As explained in the usage instructions and shown in the example, items are collected into groups in the order the groups are listed, and empty groups are not shown. To display a group out of the order in which groups are listed, use =:order=.

** 1.4-pre

Additions

Changes

** 1.3

Additions

Fixes

** 1.2

Added

Changed

Fixed

Updated

Internal

** 1.1.1

Fixed

** 1.1

Additions

Internal

** 1.0.3

Fixed

** 1.0.2

Fixed

** 1.0.1

Fixes

** 1.0.0

First tagged version.

Contributions and feedback are welcome.

If you find this useful, I'd appreciate if you would share a screenshot or two of your agenda views using it (minus any private data, of course). I'd like to get ideas for how to better organize my agenda. :)

** Bugs

** Tests

It's easy to run the tests:

  1. Install [[https://github.com/cask/cask][Cask]].
  2. From the repo root directory, run =cask install=, which installs Emacs and package dependencies into the =.cask= directory.
  3. Run =make test=.

GPLv3+

Much borrowed from Org's =org-manual.org=.

+OPTIONS: broken-links:t *:t

** Info export options

+TEXINFO_DIR_CATEGORY: Emacs

+TEXINFO_DIR_TITLE: Org Super Agenda: (org-super-agenda)

+TEXINFO_DIR_DESC: Flexible grouping for the Org Agenda

NOTE: We could use these, but that causes a pointless error, "org-compile-file: File "..README.info" wasn't produced...", so we just rename the files in the after-save-hook instead.

+TEXINFO_FILENAME: org-super-agenda.info

+EXPORT_FILE_NAME: org-super-agenda.texi

** File-local variables

NOTE: Setting org-comment-string buffer-locally is a nasty hack to work around GitHub's org-ruby's HTML rendering, which does not respect noexport tags. The only way to hide this tree from its output is to use the COMMENT keyword, but that prevents Org from processing the export options declared in it. So since these file-local variables don't affect org-ruby, wet set org-comment-string to an unused keyword, which prevents Org from deleting this tree from the export buffer, which allows it to find the export options in it. And since org-export does respect the noexport tag, the tree is excluded from the info page.

Local Variables:

before-save-hook: org-make-toc

after-save-hook: (lambda nil (when (and (require 'ox-texinfo nil t) (org-texinfo-export-to-info)) (delete-file "README.texi") (rename-file "README.info" "org-super-agenda.info" t)))

org-export-initial-scope: buffer

org-comment-string: "NOTCOMMENT"

End: