When a mode is added to or removed from a buffer, its mode hook
is invoked. The hook functions take two arguments, the buffer
involved and t
if the mode is being added or nil if it is being
removed.
Mode hooks are typically used to make a mode do something additional to what it usually does. One might, for example, make a text mode hook that turned on auto-fill mode when you entered.