Here is one way, but it's mainly aimed at improving performance, not guaranteeing a particular function signature. (Yet another reason to avoid using buffer-match-p as far as I'm concerned.)