From: Kevin McCarthy Date: Mon, 27 Jul 2015 21:09:55 +0000 (-0700) Subject: Add "Mailbox Matching in Hooks" section to manual. X-Git-Tag: neomutt-20160307~31 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d8a7295115120739f816e064b1930929daea9a8d;p=neomutt Add "Mailbox Matching in Hooks" section to manual. Folder-hook and mbox-hook perform mailbox shortcut expansion on the regexp parameter. Add a section to the manual to give examples and make the behavior clearer. --- diff --git a/doc/manual.xml.head b/doc/manual.xml.head index 109bd2db8..b88f8769b 100644 --- a/doc/manual.xml.head +++ b/doc/manual.xml.head @@ -2423,6 +2423,12 @@ mailbox matches multiple folder-hooks, they are executed in the order given in the .muttrc. + +The regexp parameter has mailbox +shortcut expansion performed on the first character. +See for more details. + + If you use the ! shortcut for spool mailbox and read. + +The regexp parameter has mailbox +shortcut expansion performed on the first character. +See for more details. + + Unlike some of the other hook commands, only the first matching regexp is used (it is not possible @@ -5575,6 +5587,43 @@ time will be used. + +Mailbox Matching in Hooks + + +Hooks that match against mailboxes (folder-hook, +mbox-hook) apply both regular +expression syntax as well as mailbox +shortcut expansion on the regexp parameter. There is some +overlap between these, so special attention should be paid to the first +character of the regexp. + + + +# Here, ^ will expand to "the current mailbox" not "beginning of string": +folder-hook ^/home/user/Mail/bar "set sort=threads" + +# If you want ^ to be interpreted as "beginning of string", one workaround +# is to enclose the regexp in parenthesis: +folder-hook (^/home/user/Mail/bar) "set sort=threads" + +# This will expand to the default save folder for the alias "imap.example.com", which +# is probably not what you want: +folder-hook @imap.example.com "set sort=threads" + +# A workaround is to use parenthesis or a backslash: +folder-hook (@imap.example.com) "set sort=threads" +folder-hook \@imap.example.com "set sort=threads" + + + +Keep in mind that mailbox shortcut expansion on the regexp parameter +takes place when the hook is initially parsed, not when the hook is +matching against a mailbox. + + + +