I'm trying to configure mutt so that whenever I switch to a folder, it collapses all threads by default, except those containing unread messages.

This is the folder hook I've written so far:

folder-hook . "push <collapse-all><tag-pattern>~(~N)<enter><tag-prefix-cond><collapse-thread>"
  • collapse-all collapses all threads;
  • tag-pattern: ~(~N) tags all visible (thread parent) messages belonging to threads containing unread messages;
  • tag-prefix-cond is supposed to make the next function apply to all tagged messages;
  • but it appears collapse-thread doesn't respond to the tag prefix (my guess is that's because it's written to act on threads, not messages).

So can this be done? (without writing a patch to mutt, that is?)

1 Answer 1


I think You do not even need a macro. There are configuration options regarding (un)collapsing.

Try following configuration and comment the macro:

set collapse_all = yes 
set uncollapse_new = no # (default is yes)
  • collapse_all is not a mutt variable.
    – MetaEd
    Commented May 9, 2023 at 18:36
  • You're right. I'm using neomutt and this config options doesn't exist in mutt. Commented Jun 30, 2023 at 7:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .