I have a set of org files all in one directory, as follows

'(org-agenda-files (quote ("~/GTD/ActiveProjects/"))) 

I would like to have an agenda that excludes one file Home.org so that I don't see it when I'm at work. Here is my current custom agenda setup

    (("n" "Today's agenda and all next actions for current projects"
      ((agenda ""
           ((org-agenda-ndays 1)
        (org-agenda-time-grid nil)))
       (tags-todo "CALL|URGENT"
          ((org-agenda-overriding-header "Urgent Home tasks")
          ((org-agenda-overriding-header "All next actions except those under NEXTMONTH or SOMEDAY "))))
      ((org-agenda-compact-blocks t))

This does what I want it to do, that is it shows me all the work TODOs in the last command, and in the second-last command it shows TODOs from Home.org but only CALLs and URGENTs.

But I would like to have the Home.org (for re-fileing into it) in the same folder as the other org files, and set the org-agenda-files to all org files in the ~/GTD/ActiveProjects/ directory except Home.org

I've read about seq-filter and remove-if and to use them in a custom org-agenda-files something like this:

          ((org-agenda-overriding-header "All next actions except those under NEXTMONTH or SOMEDAY "))

What's the easiest way to do this?

4 Answers 4


Do the following steps:

1. Tag all entries in the Home.org file.

This can be done the easiest with a FILETAGS, which applies the tag on all entries in the given file. This can be achieved by adding the following at the top of the Home.org file:


2. Create a custom agenda command to filter out tagged entries:

   '(("c" "Custom agenda, ignore HOME tag"
      ((agenda ""))
      ((org-agenda-tag-filter-preset '("-HOME"))))))

With this, when you open the org-agenda next time, you can use the c shortcut to load the custom agenda, where all entries with the :HOME: tag are being filtered out.

  • Great solution -- I wasn't aware of #+FILETAGS: but it works super well with the org way.
    – jtmoulia
    Commented Sep 10, 2020 at 1:28
  • One additional comment: once you have the #+FILETAGS: header defined, from the agenda view you can use org-agenda-filter-by-tag to do ad-hoc tag exclusions.
    – jtmoulia
    Commented Sep 10, 2020 at 1:40

Here's another way to do this (it excludes home.org from the list of all .org files in tasks/ folder of org-directory):

(agenda "" ((org-agenda-files
            (--remove (s-matches? "home.org$" it) (f-glob "tasks/*.org" org-directory)))))

It requires libraries dash.el, f.el and s.el.


To exclude a file from a directory of org files, just remove it:

(remove "/path/to/file" org-agenda-files)

Here is my custom command for excluding everything from ~/Dropbox/org/work.org:

(setq org-agenda-custom-commands
      '(("n" "Non-work"
         ;; Show all todos and everything due today, except work related tasks.
         ((agenda "" (
                      ;; Limits the agenda to a single day
                      (org-agenda-span 1)
          (todo "TODO"))
         ((org-agenda-files (remove "~/Dropbox/org/work.org" org-agenda-files))))))

Take a look at the variable org-agenda-files:

The files to be used for agenda display.

If an entry is a directory, all files in that directory that are matched
by org-agenda-file-regexp will be part of the file list.

If the value of the variable is not a list but a single file name, then
the list of agenda files is actually stored and maintained in that file,
one agenda file per line.  In this file paths can be given relative to
org-directory.  Tilde expansion and environment variable substitution
are also made.

Entries may be added to this list with M-x org-agenda-file-to-front
and removed with M-x org-remove-file.

So you could create a file, /wherever/org_files.org, and include everything except the file(s) you want to exclude. You could also modify the org-agenda-file-regexp to exclude file(s). Or use M-x org-remove-file when you have the file you want to remove opened.

When testing, M-x org-remove-file modifies the value of org-agenda-files to be all the current org agenda files, minus the one you just removed. When I added a new file to my org directory, the value of org-agenda-files was not updated to add that file, so I'm hesitant to seriously suggest M-x org-remove-file. Same with pointing org-agenda-files at a file, you'd have to manually update that file every time you add a new file in your org directory. So it seems to me that the best solution is to update the regex.

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.