Yes I understand your point. However, setting TODO for each category manually would be laborious in my situation, I have to adjust the configuration file each time I add/delete the project.

For my implementation, I advice on function 'org-agenda-finalize-entries' to put lists into different groups, limit them and add separator after the line '(setq list (mapcar 'org-agenda-highlight-todo list))'

There's a 'org-agenda-before-sorting-filter-function' variable. However, I'm not able to use it for grouping things, because it's used as '(mapcar org-agenda-before-sorting-filter-function list)'

Would it be useful to add another function here, not used in 'mapcar', but work directly on the whole list? I don't know whether it is worthy, and I'm OK if that's not general enough to be added, because I can use defadvice anyway :)


On Mon, Feb 11, 2013 at 9:42 PM, Bastien <bzg@altern.org> wrote:
Hi Muchenxuan,

Muchenxuan Tong <demon386@gmail.com> writes:

> My intention is to limit the number of tasks in each category.

Did you check (info "(org)Block Agenda") ?

That's the way I would suggest: define a block agenda listing
the various categories, then use `org-agenda-max-todos' in each
of them to limit the number of TODOs.

> For the new proposed 'org-agenda-max-todos', I can only limit the
> number of TODOs in the whole TODO lists.
>
> Maybe for what I want, it's desirable to add a auto-split or
> auto-group features, where a list of TODOs, can be split further into
> multiple lists of TODOs, by a certain criteria (tags, category).
>
> What do you think about it?

I understand defining block agendas is not as straightforward than the
solution you envision, but my feeling is that allowing grouping+limits
will have too much overlap with the block agenda functionality.

Let me know if you find the path to happiness with a combinaison of
block agendas and the new variables.

Thanks,

--
 Bastien