4

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

 '(org-agenda-custom-commands
   (quote
    (("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-files
            (quote
             ("~/GTD/OtherAORs/Home.org")))))
       (tags-todo "-NEXTMONTH-SOMEDAY-SCHEDULED-DEADLINE"
          ((org-agenda-overriding-header "All next actions except those under NEXTMONTH or SOMEDAY "))))
      ((org-agenda-compact-blocks t))
      ("~/Dropbox/org-mode/work-agenda.txt")))))

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:

       (tags-todo "-NEXTMONTH-SOMEDAY-SCHEDULED-DEADLINE"
          ((org-agenda-overriding-header "All next actions except those under NEXTMONTH or SOMEDAY "))
(org-agenda-files
            (quote
             ("~/GTD/OtherAORs/Home.org")))))

What's the easiest way to do this?

2

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:

#+FILETAGS: HOME

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

(set-custom-variables
 '(org-agenda-custom-commands
    ("c" "Custom agenda"
      ((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.

1

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.

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.