On 2010-03-18, peng shao <shallp...@gmail.com> wrote: > I recently found the following interesting phenomenon: > > I included the following lines in my muttrc > > mailboxes ~/.MuttMail/inbox > set spoolfile=~/.MuttMail/inbox > folder-hook . 'push :default' > folder-hook inbox 'push :inbox' > > This is the only four lines in the muttrc because I want to do a clean > test. If the folder-hook is used to set variables then I was told by > the manual > http://www.mutt.org/doc/manual/manual-4.html > that I should place the default hook EARLIER than the specific hook, > as I did in the test. > > However, the result is is I enter mutt then I have > > :inbox:default > > at the bottom command area. It contradicts with my understanding to > the folder-hook because the order is reversed compared to the manual. > > Is this a bug, or supposed way?
It's the way it's supposed to work, but it is confusing. Folder hooks are processed as the manual says. However, the push command pushes its arguments onto a stack and mutt's input parser later pops those arguments off the stack to parse and execute them. It's that pushing and popping that reverses the order of your pushed commands. The solution is to enter those folder hooks that contain pushes into your muttrc "upside down", like this: folder-hook inbox 'push :inbox' folder-hook . 'push :default' It would be nice to be able to put commands into a queue rather than onto a stack. I don't know why it is the way it is. Regards, Gary