Irreal's quest for world domination has been temporarily suspended due to the DDoS attack on Dyn. While we wait for the issue to get resolved, here's a very nice offering from mbork (Marcin Borkowski).
recenter-top-bottom (bound to Ctrl+l) all the time time but didn't know about
reposition-window. The effect is similar but
reposition-window tries to get the current function definition—for various values of “function definition”—or the associated comment onto the screen where it will be visible to the maximum extent. The behavior's a bit complicated so you should read the docstring to see exactly what happens.
The situation that
reposition-window is designed to handle happens often enough that it's worth remembering the command. The fact that it's bound to almost the same sequence as
recenter-top-bottom makes it easy to remember how to invoke it, at least if you use
recenter-top-bottom a lot like I do.