<<< Date Index >>>     <<< Thread Index >>>

Re: mutt 1.4.2.1 not honoring folder-hooks with imap



On Tuesday, December 13 at 09:54 PM, quoth Tyler Spivey:
Hello. I'm using mutt 1.4.2.1 (old, probably going to upgrade to 1.5.x soon) 
under Cygwin, Windows XP. I'm using Imap: and have the following folder hook:
folder-hook . set sort=threads
folder-hook "!" set sort=date
the inbox (!) hook seems to work, but I"m not sure. When I switch to naother 
mailbox, the hook to set sorting by threads doesn't seem to work.
Any help would be appreciated.

I'm not sure what you think this is supposed to achieve here.

The folder-hook syntax consists of three strings: "folder-hook" "regexp-with-an-optional-exclamationpoint" and "command" -- you're giving it four strings (granted, I don't know exactly when mutt decides to read four or more strings and when it starts to get confused, I just know that to be on the safe side you should put your command in quotes), and the regexp in the second one doesn't make sense (it seems to say "match anything that does not match the empty string").

I guess mutt is probably taking them to be essentially equivalent regular expressions, since everything matches both any character (the first one) and does not match the empty string (the second one). If that's true, then it makes sense because folder-hooks are executed in the order they appear in your muttrc -- so the second one supercedes the first.

Try this:

folder-hook . "set sort=threads"
folder-hook =$ "set sort=date"

Remember, = is shorthand for the contents of $folder.

I use something different that may be totally unnecessary, and may not work for your circumstance, but is more flexible for me:

folder-hook . 'set sort=threads'
folder-hook "(INBOX|Maildir)/?$" 'set sort=date'

Hope that helps,

~Kyle
--
If we knew what it was we were doing, it would not be called research, would it?
                                               -- Albert Einstein, 1941

Attachment: pgp00uD3uarOr.pgp
Description: PGP signature