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?


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
    Sep 10 '20 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
    Sep 10 '20 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))))))

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.