I want to scroll the buffer so that the the current line is, say, 300 pixels from the beginning of the window.

Something like this:

. \ 
. | (300 pixels)
. /
| <-- (current line)

Any ideas?

Note that the buffer may contain figures and different font sizes, so scrolling a fixed number of text lines won't do the trick.

1 Answer 1


You can set the vertical scroll parameter of your current window (and other windows, too) with pixel precision:

(set-window-vscroll nil 300 t)

This will however not work with any value greater than the frame height though. I've had to hand in a bug where Emacs hangs up for certain display engine configurations upon doing this even.

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.