I want my default agenda view to include archived trees from .org_archive files. From the manual we learn:

v a (org-agenda-archives-mode)
v A (org-agenda-archives-mode 'files)
Toggle Archives mode. In Archives mode, trees that are marked ARCHIVED are also scanned when producing the agenda. When you use the capital A, even all archive files are included. To exit archives mode, press v a again.

However, when I (org-agenda-archives-mode 'files) I get the following error at startup:

Symbol's function definition is void: org-agenda-archives-mode

How can I get the default-agenda to include archived trees?

  • Not an answer to your question regarding defaults ..., but whenever you receive a void function definition it is because the library has not yet been loaded. Try: (require 'org-archive) and then you can use functions from that library.
    – lawlist
    Jan 17 '20 at 0:56
  • Unfortunately, there is no package called org-archive.
    – loki
    Jan 17 '20 at 14:29
  • The file org-archive.el is part of the org-mode library: github.com/emacs-mirror/emacs/blob/master/lisp/org/…
    – lawlist
    Jan 18 '20 at 6:37
  • Oh, I am sorry for this misunderstanding. I still get the error when including (require 'org-archive) in my config, though.
    – loki
    Jan 19 '20 at 9:58
  • I ended up grepping for the function within the org-mode source code and found it here: github.com/emacs-mirror/emacs/blob/master/lisp/org/… The org-agenda.el library can be loaded the same way: (require 'org-agenda)
    – lawlist
    Jan 19 '20 at 17:30

org-agenda-archives-mode is a variable defined in org-agenda.el. Its default value is nil

Non-nil means the agenda will include archived items.
If this is the symbol ‘trees’, trees in the selected agenda scope
that are marked with the ARCHIVE tag will be included anyway.  When this is
t, also all archive files associated with the current selection of agenda
files will be included.

org-agenda-archives-mode is also a function; however, the O.P. seeks to set the default value and this is done via the variable.

In general, org-mode uses prefixes to let the user know which library contains variables/functions with said prefixes. In this case, the prefix is org-agenda-.... Thus, we want to load the library before setting the variable.

(require 'org-agenda)
(setq org-agenda-archives-mode t)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.