Unfortunately setq won t work for this, as this is a function, not a variable. You need to either use customize to set the variable, or to call the which-function-mode function passing a value of t .
customize is the way that emacs deals with configuring functionality for most packages nowadays. Often doing M-x customize-apropos followed by a the name of the package will give you most of the configuration options for that package. If you know the specific name of the configuration parameter, you can also use customize-variable to go to that specific parameter. Note that the items in customize-variable are not always variables per se - often customize calls a function or performs some other activity to actually perform the configuration.
I think you probably want to use customize for this.
M-x customize-variable<RET>
which-function-mode
should give you something like the following:
Toggle the value to on , then set for the current session and save for future sessions. If you don t like customize, you can just call the function from your .emacs:
(which-function-mode t)
This is in emacs 23, but I believe 22 should be similar.... For emacs 21, I don t believe customize was in there by default (it s been a long time, though so I could be wrong), and you might have to use the function call form instead.