On 2014-06-28, Koralatov wrote: > (And my understanding of mutt's hook operation was that the last > instruction overrides any preceding ones, so having the default > last shouldn't be right anyway.)
Mutt has two types of hooks. One type invokes an operation that can be performed multiple times per event. An example of that type would be the folder-hook. There are all sorts of settings you might like to make or operations you might like to perform on entering a folder having certain attributes. When mutt enters a folder, it traverses its list of folder-hooks looking for patterns that match the folder name, executing every match it finds. When setting a particular option with that type of hook, you need to specify the more general patterns first and the more specific patterns later because the setting performed by the last matching pattern "wins". The other type of hook invokes an operation that can be performed only once per event or that can set only one value per event. An example of that type would be the fcc-hook. You can set only one fcc: mailbox per message. Therefore, when searching the list of fcc-hooks, mutt sets the fcc: mailbox to the value of the first matching hook and stops searching. When specifying that type of hook, you need to specify the more specific patterns first and the more general patterns later because if mutt finds a match to a general pattern, it will stop searching and never try a later more specific pattern. The mutt manual describes this behavior of the fcc-hook in the section, "Specify Default Fcc: Mailbox When Composing", as Mutt searches the initial list of message recipients for the first matching regexp and uses mailbox as the default Fcc: mailbox. > The correct version is below: > > fcc-hook .* =Sent > fcc-hook @googlegroups\.com /dev/null > --> fcc-hook @koralatov\.com /dev/null <-- works! > fcc-hook @lists\.alioth\.debian\.org /dev/null > fcc-hook @lists\.sourceforge\.net /dev/null > fcc-hook @mailman\.lug\.org\.uk /dev/null > fcc-hook @reply\.github\.com /dev/null > fcc-hook @six\.pairlist\.net /dev/null > fcc-hook mutt-users@mutt\.org /dev/null > > Since my original email, I've tried the following to fix the problem: > > * Removing the leading `@' symbol from the domains (even though it > works fine for the koralatov.com domain /with/ the `@' symbol) > * Tried the form `*@googlegroups\.com' > * Tried the form `.*@googlegroups\.com' > * Tried the form `\.*googlegroups\.com' > > None of the above have worked; mutt still defaults to using =Sent as > the FCC for outgoing e-mails to everything *except* the @koralatov.com > domain. I'm still completely bamboozled, and no closer to fixing it. In your case, the first fcc-hook pattern is ".*" which matches anything and prevents later patterns from being considered. That of course raises the question: why does the pattern "@koralatov\.com" seem to work? Do you have "@koralatov.com" anywhere else in your muttrc that would cause it to be used as the default fcc: mailbox, overriding Sent? I'm thinking of options such as $copy, $record, $save_name, $force_name and the fcc-save-hook. I'm afraid I'm not familiar enough with the various factors affecting the setting the fcc: mailbox to have any better idea of where the problem might be. Regards, Gary