1

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\\'"
Hugh_Kelley
  • 237
  • 2
  • 11
  • 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 Mar 22 '20 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. – Hugh_Kelley Mar 22 '20 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 Mar 22 '20 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 Mar 22 '20 at 19:30
  • just from the org habits feature https://orgmode.org/manual/Tracking-your-habits.html. Org-agenda-files doesn't list any archive files. it ends with ` ...)` though so maybe the list continues? – Hugh_Kelley Mar 22 '20 at 19:46
  • 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 https://emacs.stackexchange.com/questions/34413/what-is-the-meaning-of-the-ellipsis-at-the-end-of-some-output for some settings that will allow you to see the whole thing. – NickD Mar 22 '20 at 22:13
  • thanks for your help – Hugh_Kelley Mar 22 '20 at 23:18

1 Answers1

1

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.

NickD
  • 27,023
  • 3
  • 23
  • 42
Hugh_Kelley
  • 237
  • 2
  • 11