I'm trying to use avy to define a function that jumps to a line, recenters the screen at that line, then goes back to the initial position. The problem is that after recentering the initial position might not be on the screen anymore, in which case I would like the function to remain on the line it jumped to. For this I need some means to check whether the initial position is on the screen or not. Is there? I couldn't find anything with a quick look in the documentation.

1 Answer 1


You can use the window-start function to get the 'position at which display currently starts in WINDOW' (see its docstring), and compare that position after recentering to your initial position.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.