beginning-of-defun-function is a variable defined in `lisp.el'.
Its value is

  • This variable may be risky if used as a file-local variable.

If non-nil, function for `beginning-of-defun-raw' to call.
This is used to find the beginning of the defun instead of using the
normal recipe (see `beginning-of-defun'). Major modes can define this
if defining `defun-prompt-regexp' is not sufficient to handle the mode's

The function takes the same argument as `beginning-of-defun' and should
behave similarly, returning non-nil if it found the beginning of a defun.
Ideally it should move to a point right before an open-paren which encloses
the body of the defun.