Which Function mode is a minor mode that displays the current function name in the mode line, updating it as you move around in a buffer.
To either enable or disable Which Function mode, use the command
M-x which-function-mode. This command applies to all buffers,
both existing ones and those yet to be created. However, it takes
effect only in certain major modes, those listed in the value of
which-func-modes. If the value of
t rather than a list of modes, then Which Function mode applies
to all major modes that know how to support it—in other words, all
the major modes that support Imenu.