11.1 Agenda Files

The information to be shown is normally collected from all agenda files, the files listed in the variable org-agenda-files90. If a directory is part of this list, all files with the extension ‘.org’ in this directory are part of the list.

Thus, even if you only work with a single Org file, that file should be put into the list91. You can customize org-agenda-files, but the easiest way to maintain it is through the following commands

C-c [ (org-agenda-file-to-front)

Add current file to the list of agenda files. The file is added to the front of the list. If it was already in the list, it is moved to the front. With a prefix argument, file is added/moved to the end.

C-c ] (org-remove-file)

Remove current file from the list of agenda files.

C-, (org-cycle-agenda-files)

Cycle through agenda file list, visiting one file after the other.

M-x org-switchb

Command to use an Iswitchb-like interface to switch to and between Org buffers.

The Org menu contains the current list of files and can be used to visit any of them.

If you would like to focus the agenda temporarily on a file not in this list, or on just one file in the list, or even on only a subtree in a file, then this can be done in different ways. For a single agenda command, you may press < once or several times in the dispatcher (see The Agenda Dispatcher). To restrict the agenda scope for an extended period, use the following commands:

C-c C-x < (org-agenda-set-restriction-lock)

Restrict the agenda to the current subtree. If there already is a restriction at point, remove it. When called with a universal prefix argument or with point before the first headline in a file, set the agenda scope to the entire file. This restriction remains in effect until removed with C-c C-x >, or by typing either < or > in the agenda dispatcher. If there is a window displaying an agenda view, the new restriction takes effect immediately.

C-c C-x > (org-agenda-remove-restriction-lock)

Remove the restriction created by C-c C-x <.

When working with Speedbar, you can use the following commands in the Speedbar frame:

< (org-speedbar-set-agenda-restriction)

Restrict the agenda to the item—either an Org file or a subtree in such a file—at point in the Speedbar frame. If agenda is already restricted there, remove the restriction. If there is a window displaying an agenda view, the new restriction takes effect immediately.

> (org-agenda-remove-restriction-lock)

Remove the restriction.



If the value of that variable is not a list, but a single file name, then the list of agenda files in maintained in that external file.


When using the dispatcher, pressing < before selecting a command actually limits the command to the current file, and ignores org-agenda-files until the next dispatcher command.