In org-mode, M-x org-agenda a will display a built-in agenda view labeled "Agenda for current week or day". How can I exclude a tag from this view?

Parenthetical clarification

I know how to filter a tag out of this view after it is displayed, but I would like to add something to my configuration to exclude the tag by default.

I know how to exclude a tag from a custom agenda view, but I would like to exclude a tag from the built-in agenda view labeled "Agenda for current week or day".


2 Answers 2


I you don't want to see :foo:, this should exclude it:

(setq org-agenda-tag-filter-preset '("-foo"))

However, the doc string says:

This variable should not be set directly, but agenda custom commands can bind it in the options section.

So, let bind the variable before calling org-agenda by defining your own wrapper function:

(defun yashi/org-agenda (&optional arg)
  (interactive "P")
  (let ((org-agenda-tag-filter-preset '("-foo")))
   (org-agenda arg "a")))

And bind it to, say, F1

(bind-key "<f1>" 'yashi/org-agenda)
  • What does "bind it in the options section" actually mean?
    – RichieHH
    Commented Feb 3, 2020 at 20:32

As Yasushi Shoji mentioned, the correct approach is to let-bind org-agenda-tag-filter-preset. To advise just the one pre-built agenda view, you'll want to use advice around the function org-agenda-list, which builds just that particular view. Try this:

(defun my/org-agenda-list-exclude-tags-advice (orig-fn &rest args)
  "Exclude selected tags from `org-agenda-list'.
Intended as :around advice for `org-agenda-list'."
  (let ((org-agenda-tag-filter-preset '("-foo")))
    (apply orig-fn args)))

(advice-add #'org-agenda-list :around #'my/org-agenda-list-exclude-tags-advice)
  • Shouldn't it be (apply org-fn args) instead of funcall?
    – Artem Yu
    Commented May 2, 2020 at 7:23
  • @grepcake: Yes, I believe you're right. Fixing it now. Commented May 2, 2020 at 14:53

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.