How do you limit the number of results under a particular heading in a block custom agenda view?

I use a custom agenda with several blocks. For example:

(defun tagstatus (tagName)
    "helper to make tags filter with preset TODO statuses"
    (concat "+" tagName "/!+TODO|+NEXT|+STARTED"))

(setq org-agenda-custom-commands
     '(("z" "custom agenda blocks"
        ((agenda "" ((org-agenda-overriding-header "Today") (org-agenda-span 'day)))
         (tags (tagstatus "tag1") ((org-agenda-overriding-header "Tag 1 Items")))
         (tags (tagstatus "tag2") ((org-agenda-overriding-header "Tag 2 Items")))

I would like to be able to limit the number of items that are shown under a given header. For example, limit "Tag 1 Items" to the top 5 TODOs that match that tagName. Is this possible? How?

I have looked at Limiting Agenda Items (https://orgmode.org/manual/Filtering_002flimiting-agenda-items.html), and org-agenda-max-entries; it seems simple enough to set that globally, but I don't understand how to integrate it into a block view.

1 Answer 1


Untested, so just a guess:

   (tags (tagstatus "tag1") ((org-agenda-overriding-header "Tag 1 Items")
                             (org-agenda-max-entries 5)))

or maybe org-agenda-max-tags instead of org-agenda-max-entries.

  • Thanks, this is what I tried, but for some reason it didn't work for me the first time I tried it. But this works to limit the results, exactly what I needed.
    – rdcdr
    Commented Mar 15, 2023 at 18:18

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.