2

In ~/.emacs/init.el i have:

(setq org-agenda-files (list "~/org"))

Most of the .org files in that directory have associated .org_archive files with a long history of archived TODO tasks.

When I run org-agenda, it collects any TODO item in the .org_archive files.

Is there a regex type solution to exclude files ending in .org_archive? I've previously identified individual files to include in the agenda view but that's getting a little cumbersome.

The value of org-agenda-file-regexp is:

"\\`[^.].*\\.org\\'"
7
  • 1
    There is org-agenda-file-regexp but its default setting should not allow matching foo.org_archive files anyway. What is the value of that variable in your setup? Please edit the question and add that information.
    – NickD
    Commented Mar 22, 2020 at 16:46
  • hmm added, The value looks as though it should exclude things ending in .org_archive but I recompiled the agenda and it definitely includes items from archive files. I noticed that it seems like it's only items that I set the Style property to habit. If that property is commented out they no longer appear in the agenda. Commented Mar 22, 2020 at 16:57
  • What does (org-agenda-files) return? You can evaluate that by entering it in your *scratch* buffer and pressing C-j. The return value should be a list of all the agenda files. Does it include any .org_archive files?
    – NickD
    Commented Mar 22, 2020 at 18:23
  • 1
    I don't know what a Style property does: AFAICT, it's not special to Org mode at all. Are you using some third-party package that uses that?
    – NickD
    Commented Mar 22, 2020 at 19:30
  • 1
    Yes, you are right. It's actually spelled STYLE in the code, which is why I didn't find it at first (note to future self: use grep -i). The ellipsis does indeed mean there is more: see emacs.stackexchange.com/questions/34413/… for some settings that will allow you to see the whole thing.
    – NickD
    Commented Mar 22, 2020 at 22:13

1 Answer 1

2

Check the value of org-agenda-archive-mode. In my case it was set to true in my init.el.

(setq org-agenda-archives-mode t)

Setting it to nil (the default) makes it so that archived items are not included in the agenda.

The docstring of the variable says:

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.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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