0

While customizing org-agenda,

(setq org-agenda-custom-commands '(("u" "Updated Tasks" todo "" ((org-agenda-files (remove "~/org/old.org" org-agenda-files)))))) 

removes file ~/org/old.org from agenda files. What do I do if I want to remove multiple files, say, ~/org/old.org and ~/org/older.org from the org-agenda-files?

(setq org-agenda-custom-commands '(("u" "Updated Tasks" todo "" ((org-agenda-files (remove "~/org/old.org" "~/org/older.org" org-agenda-files)))))) 

does not work.

There is a solution here. More specifically, here.

But I was wondering if I could not remove multiple files using the current approach.

3
  • What exactly do you mean by "current approach"? Commented Jul 4, 2024 at 18:04
  • You can use nested remove calls to eliminate one item at a time, or you can use a slighty more general function like -remove (from dash.el) to filter out what you don't want. Personally, I would go with the latter. Is that what you mean? Commented Jul 4, 2024 at 19:15
  • @NickD Thanks. Nesting remove did work as expected. I will add that as an answer for easy reference. Commented Jul 5, 2024 at 12:46

1 Answer 1

0

As @NickD suggested in a comment, one can nest remove calls. So, here is the solution:

(setq org-agenda-custom-commands '(("u" "Updated Tasks" todo "" ((org-agenda-files (remove "~/org/older.org" (remove "~/org/old.org" org-agenda-files))))))) 

This removes older.org from a list that already had old.org removed.

1
  • For more than a couple of files I would recommend the other solution: using -remove from dash.el. Commented Jul 5, 2024 at 13:36

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.