Which Function mode is a global minor mode (see Minor Modes) which 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. Which Function mode is a global minor
mode. By default, it takes effect in all major modes that
know how to support it (i.e., all the major modes that support
Imenu). You can restrict it to a specific list of major modes by
changing the value of the variable
t (which means to support all available major modes) to a list
of major mode names.