Ian,

* On Wed, Jul 15, 2015 01:00PM -0700 Ian Zimmerman ([email protected]) muttered:
> It is not clear from the manual against what the folder-hook command
> matches the given pattern.

folder-hooks use substring matches.

> Let's say my folders are under /home/itz/foobar/ , and /home/itz/Mail is
> a symbolic link to foobar.  Let us further assume the following is set
> globally:
> 
> set folder=~/Mail
> 
> Which of the following will fire when entering /home/itz/foobar/inbox ?

Well, why didn't you just test it?
So /home/itz/Mail -> /home/itz/foobar
and $folder=~/Mail -> /home/itz/Mail

> folder-hook ^inbox "my_hdr X-Foo: Bar"

^ is a shortcut for the current mailbox. It's not BOL here.
Assume ~/Mail/foo is the current mailbox. Then ^inbox is
/home/itz/Mail/foo/inbox -> no match

> folder-hook ^=inbox "my_hdr X-Foo: Bar"

= is a shortcut for $folder
/home/itz/Mail/foo/home/itz/Mail/inbox -> no match

> folder-hook Mail/inbox "my_hdr X-Foo: Bar"

/home/itz/Mail/inbox
          ^^^^^^^^^^    -> match

> folder-hook ~/Mail/inbox "my_hdr X-Foo: Bar"

/home/itz/Mail/inbox
^^^^^^^^^^^^^^^^^^^^    -> match

> folder-hook foobar/inbox "my_hdr X-Foo: Bar"

/home/itz/foobar/inbox
          ^^^^^^^^^^^^  -> depends how you open the folder
If you open via ~/Mail it won't match.

> folder-hook ~/foobar/inbox "my_hdr X-Foo: Bar"

/home/itz/foobar/inbox
^^^^^^^^^^^^^^^^^^^^^^  -> depends how you open the folder

> folder-hook /home/itz/Mail/inbox "my_hdr X-Foo: Bar"

/home/itz/Mail/inbox    -> =inbox, match

> folder-hook /home/itz/foobar/inbox "my_hdr X-Foo: Bar"

/home/itz/foobar/inbox
^^^^^^^^^^^^^^^^^^^^^^  -> depends how you open the folder

Your best match is spelling out the complete path, to avoid substring
matches with other folders.
"folder-hook inbox" will match anything with the string "inbox".
~/Mail/inbox
/inbox
~/Mail/myinbox
etc.

Let's ignore the symlink for now.
You want to match /home/itz/Mail/inbox and that is =inbox in short.

folder-hook . "unmy_hdr X-Foo"
folder-hook =inbox "my_hdr X-Foo: Bar"

> Now assume in addition that inbox is in fact a maildir.
> 
> folder-hook ^inbox/ "my_hdr X-Foo: Bar"

See the note about ^ above. You don't need a trailing / with maildir

HTH,

Michael
-- 
PGP-Key-ID:     EEE7D043
Jabber:         [email protected]

Reply via email to