Next: , Previous: Custom agenda views, Up: Custom agenda views


8.6.1 Storing searches

The first application of custom searches is the definition of keyboard shortcuts for frequently used searches, either creating an agenda buffer, or a sparse tree (the latter covering of course only the current buffer). Custom commands are configured in the variable org-agenda-custom-commands. You can customize this variable, for example by pressing C-c a C. You can also directly set it with Emacs Lisp in .emacs. The following example contains all valid search types:

     (setq org-agenda-custom-commands
           '(("w" todo "WAITING")
             ("W" todo-tree "WAITING")
             ("u" tags "+BOSS-URGENT")
             ("v" tags-todo "+BOSS-URGENT")
             ("U" tags-tree "+BOSS-URGENT")
             ("f" occur-tree "\\<FIXME\\>")))

The initial single-character string in each entry defines the character you have to press after the dispatcher command C-c a in order to access the command. The second parameter is the search type, followed by the string or regular expression to be used for the matching. The example above will therefore define:

C-c a w
as a global search for TODO entries with `WAITING' as the TODO keyword
C-c a W
as the same search, but only in the current buffer and displaying the results as a sparse tree
C-c a u
as a global tags search for headlines marked `:BOSS:' but not `:URGENT:'
C-c a v
as the same search as C-c a u, but limiting the search to headlines that are also TODO items
C-c a U
as the same search as C-c a u, but only in the current buffer and displaying the result as a sparse tree
C-c a f
to create a sparse tree (again: current buffer only) with all entries containing the word `FIXME'.