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

Re: Threading with IMAP folders



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Saturday, October 25 at 03:13 PM, quoth Matt Harrison:
>> What do your folder hooks look like? It sounds like they're just 
>> not matching the folder name/path.
>
>That is almost exactly what I was using, here is my folder-hooks:
>
>folder-hook    .               set sort=threads
>folder-hook    .               set sort_aux=date-sent
>folder-hook    "!"             set sort=date-received
>folder-hook    "sent-mail"     set sort=reverse-date
>
>However this wasn't working for IMAP.

No? Hmmmm...

Ahhhh, I have a guess as to what's happening. I bet it's that third 
line. It seems possible to me that the folder-hook isn't treating that 
"!" as a shortcut for $spoolfile, but is instead treating it as a 
negation of whatever regex follows it. Note that the manual describes 
folder-hook like so:

     folder-hook [!]regexp command
         When mutt enters a folder which matches regexp (or, when
         regexp is preceded by an exclamation mark, does NOT match
         regexp), the given command is executed.

So what could be happening is that mutt thinks the regex for that 
third folder hook is either an empty string OR is the string "set". In 
either case, it will match on all folders that do NOT match that 
regex, and in either case, that will essentially match all your 
folders. An empty regex shouldn't match anything, so the inverse would 
be to match everything. And unless you use the word "set" in your 
mailbox names, the same would be true for the other way of 
interpreting it. In any case, if $spoolfile is the same as $folder, 
then you probably want to use an = instead of a !, and that might just 
solve your problem.

My bet would be that "!" was intended as a shortcut to be used when 
changing folders (e.g. "c!"), and its implications as far as hooks go 
weren't considered.

>This also doesn't apply the thread sorting when using these local dot
>seperated folders, so I tried something else. Moving my layout to something
>like:
>
>~/Maildir
>~/Maildir/lists/Mutt-Users
>
>Lets me use those folder-hooks for thread sorting without problems.

REALLY! Now that is weird. That seems like there's a bug lurking in 
there somewhere.

But here's my advice: rather than modifying your mail layout to debug 
this, modify your folder-hooks. Play around with them until you have 
patterns that match what you want them to match and don't match what 
you don't want them to match. Start with a minimum set, and go from 
there.

And also, just for your own sanity, you might want to consider 
adopting the habit of quoting your hook arguments. Personally, I find

     folder-hook 'foo' 'set this=that'

...to be much more resistant to problems than

     folder-hook foo set this=that

... because it's far too easy to accidentally put something in your 
regex ("foo") that affects how the rest of the line is interpreted.

~Kyle
- -- 
Every gun that is made, every warship launched, every rocket fired 
signifies, in the final sense, a theft from those who hunger and are 
not fed, those who are cold and are not clothed.
                                                -- Dwight D. Eisenhower
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!

iEYEARECAAYFAkkDL0oACgkQBkIOoMqOI1470ACfXWNn7nF1IqFGNLamg5yDecv7
C/IAoMdctk1ABlpmE709QkIumm8s17Sm
=Yt2d
-----END PGP SIGNATURE-----